Last post Aug 16, 2011 11:17 PM by msdnphani
Aug 16, 2011 03:05 PM|Faize|LINK
I have 2 dynamically-generated DropDownLists, List1 and List2. List2 has a dependency on List1, in that List2 is populated via a method which requires List1's SelectedValue.
For some reason, List1's SelectedValue is not reloaded until after List1 has been added to the Page object (or some other container belonging to the Page object). Is there any way I can manually force the Viewstate to restore itself instead?
Aug 16, 2011 03:15 PM|XIII|LINK
dynamically added controls will get up to pace with the rest of the page life cycle as soon as possible and will then keep running in the same pace as other controls.
List1's SelectedValue is not reloaded until after List1 has been added to the Page object
You're adding List1 to the control collection again in the Init event of the page? Later on viewstate is restored, before the Page_Load. So if you don't have the adding in the Init event, put it there like described in this article:
Adding a dynamic control to a placeholder control and wire up the event.
Aug 16, 2011 11:17 PM|msdnphani|LINK
the view state of a control would be loaded only on Page_Load event .. so people sugges to create dynamic controls only on page load ..
please refer to page life cycle in asp.net