Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > textbox in user control losing values during post back

Reply
Thread Tools

textbox in user control losing values during post back

 
 
=?Utf-8?B?U3JpZGhhcg==?=
Guest
Posts: n/a
 
      08-23-2006
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.
 
Reply With Quote
 
 
 
 
Lav KG
Guest
Posts: n/a
 
      08-23-2006

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...

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3JpZGhhcg==?=
Guest
Posts: n/a
 
      08-23-2006
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...
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing TextBox values David C ASP .Net 3 11-19-2008 10:17 PM
How does a dynamic control load post back data across post back?? =?Utf-8?B?Z29yaWxsYQ==?= ASP .Net 1 05-25-2007 05:02 AM
TextBox losing value during DataGridCommandEvent jason ASP .Net 0 08-31-2005 10:12 PM
How can I send back(Post back) some values from client machine Joby ASP .Net 0 05-14-2004 04:19 AM
TextBox Controls losing their values Philip Townsend ASP .Net 1 06-27-2003 07:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57