473,378 Members | 1,429 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

textbox in user control losing values during post back

Hi,

I have a user control which has a textbox control and a button. I have
created a property to get and set the text box value. In the Page_Load method
of the Page that contains the user control, I am setting the textbox value
that is inside the user control. When I click the button that is inside the
user control and try to access the textbox value it is getting empty string
instead of the value set in the Page_Load. I have tried setting
EnableViewState explicity but still it is not holding the value. I am not
loading the user control dynamically. Please let me know if you have any
ideas.

Thanks,
Sridhar.
Aug 23 '06 #1
2 5867

Sridhar wrote:
Hi,

I have a user control which has a textbox control and a button. I have
created a property to get and set the text box value. In the Page_Load method
of the Page that contains the user control, I am setting the textbox value
that is inside the user control. When I click the button that is inside the
user control and try to access the textbox value it is getting empty string
instead of the value set in the Page_Load. I have tried setting
EnableViewState explicity but still it is not holding the value. I am not
loading the user control dynamically. Please let me know if you have any
ideas.

Thanks,
Sridhar.
Try surrounding your code by following block

if (! IsPostBack)
{
// your code.
}

let's hope it works...:)

Aug 23 '06 #2
I am trying to access the textbox inside button_click method of the user
control. Also when I am setting the textbox value in the Page_load method of
the page, I have tried setting it both inside

if not page.ispostback
end if

and also outside of it. None of them works.

Thanks,
Sridhar.

"Lav KG" wrote:
>
Sridhar wrote:
Hi,

I have a user control which has a textbox control and a button. I have
created a property to get and set the text box value. In the Page_Load method
of the Page that contains the user control, I am setting the textbox value
that is inside the user control. When I click the button that is inside the
user control and try to access the textbox value it is getting empty string
instead of the value set in the Page_Load. I have tried setting
EnableViewState explicity but still it is not holding the value. I am not
loading the user control dynamically. Please let me know if you have any
ideas.

Thanks,
Sridhar.

Try surrounding your code by following block

if (! IsPostBack)
{
// your code.
}

let's hope it works...:)

Aug 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Smith | last post by:
What I want to be able to do: A textbox is available that the user can enter information into. Specifically (for the purposes of this post), the user is asked to enter a number, and that number...
1
by: Philip Townsend | last post by:
I have a user control that contains a form with several text boxes. The text boxes get populated from a SQL Server table when the control loads. When the controls posts back, any values that have...
6
by: Alex | last post by:
I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
0
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
1
by: jqheller | last post by:
Folks I am losing my mind trying to work with the TemplatedWizardStep. I have created a multistep user registration form that collects plenty of user information including a password. At the end...
2
by: =?Utf-8?B?TG91aXNhOTk=?= | last post by:
Hello. ive just read some posts on the age old issue of losing dynamic control values on postback. Most people say recreate the controls on the onInit, but i just dont think this serves my purpose....
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.