I have a custom server control (composite control having dynamically created dropdown boxes and textboxes). I have enabled AJAX in order to avoid page reload.The server control is used inside the ASP.NET webcontrol having few buttons which controls the visibility of the server control. Now I enter values in the dropdown box and texboxes and click on any other button. After this postback the last entered values are gone! The control is not remembering the values. Can anyone help me? How can I retain the values after post back?
2
votes
Do you dynamically add the control during Page_Load? Or is it declared in the aspx markup already?
- Sir Crispalot
Did work ok with out ajax ? if yes then see what javascript error you get on your page after the post back.
- Aristos
I have created the custom server control in asp.net.which will dynamiclly create the dropdown boxes and textboxes in the control.Im not using asp.net markup to create the controls.<%@ Register Assembly="abc" Namespace="abc" TagPrefix="cc1" %> cc1 is the server control and em using it inside the webcontrol.It is not working without ajax also
- sharmila
3 Answers
3
votes
3
votes
If your custom server control is create dynamically all the controls, then you need to recreate them on every post, and you need to create them before the Page_Load(), or else the asp.net cant know them to filled with the post data.
To solve this, if you can not create them before the Page_Load(), then you can fill them by your self with the posted data by using the Request.Form[YourCustomControl.UniqueID] for all controls.
3
votes