Author: login.arpit | Posted on: 11/14/2008 3:50:52 AM | Views : 291

 

I'm wanting to create some dynamic controls, and have them persist their viewstate across page loads. All I have to do is re-create the controls upon each page load, using the same IDs. I want to recreate the controls after the ButtonClick event, but the problem is Page_Load occurs prior to Button_Click, while if I recreate the controls at Page_PreRender


The problem comes in after I re-create the controls in my PreRender event. The re-created controls never bind to the viewstate, and their values do not persist across page loads. I don't understand why this happens.

If I re-creating the controls in my OnLoad event, the newly created controls bind to the ViewState just fine, provided that I use the same IDs every time. However, when I try to do the same thing in the PreRender event, it fails.

The reason for selecting Page_PreRender is that I want re-create the controls after the Button_Click event. Page_Load and Page_PreIni ...

Go to the complete details ...