How to maintain the view state of dynamically added control in an asp.net page

First of all you must read these articles:

The viewstate of a dynamically added control can be saved for maintaining the state of the control after postback.
This can be achieved by adding the controls before the Load Viewstate stage (see the page stages in the articles above). Therefore the viewstate information ( control value) from the request will be applied to already added controls as they are defined already in the page.
The right place of adding dynamic controls is Page_Init. Use Page_Init also for defining dynamically master pages and themes.

No comments:

Post a Comment