Textbox in Custom Server Control not retaining data after postback

J

Jeremy Jones

I am currently building a custom combobox server control. I have
followed pretty much any example, yet my textbox does not retain the
data after postback. my LoadPostData function being fired off, and as
far as I can tell, it works fine. But by the time it is run, the value
in the textbox is gone, so it updates my property with a blank.

I have tried both WebControl.TextBox as well as
HtmlControl.HtmlInputText.

any ideas would be appreciated.

Thanks
 
M

Mark Rae

I am currently building a custom combobox server control. I have
followed pretty much any example, yet my textbox does not retain the
data after postback. my LoadPostData function being fired off, and as
far as I can tell, it works fine. But by the time it is run, the value
in the textbox is gone, so it updates my property with a blank.

I have tried both WebControl.TextBox as well as
HtmlControl.HtmlInputText.

any ideas would be appreciated.

Have you set the EnableViewState property to false...?
 
B

bruce barker

the point of the loadpostbackdata event, is for your code to move the
postback value(s) to your control. your code should set the value of the
textbox when this event fires. no viewstate is required, unless you want
to fire the changed event (you can store the previuos value in viewstate).

-- bruce (sqlwork.com)
 
J

Jeremy Jones

I got it working. Thanks!!!

the point of the loadpostbackdata event, is for your code to move the
postback value(s) to your control. your code should set the value of the
textbox when this event fires. no viewstate is required, unless you want
to fire the changed event (you can store the previuos value in viewstate).

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top