To maintain the view state of a dynamically created control
-
I created a drop downlist dynamically and i am unable to capture its values i.e its view state. I know that view state can't be retained for dynamically created controls .pls suggest a way out to retain the view state.
Actually, the dynamic control can persist data in the ViewState as the static control does. The important thing when working with the dynamic control is that you need to choose the right event to readd the dynamic controls. If this happens after the ViewState is loaded, then it will loose its ViewState data. For more information, you should read about the control life cycle in MSDN.
-
I created a drop downlist dynamically and i am unable to capture its values i.e its view state. I know that view state can't be retained for dynamically created controls .pls suggest a way out to retain the view state.
if you want to see the selected value each time, it is easy... give it an ID, say idListBox. while creating it, get the value from form variables to determine the selected value: ... selVal = request.forms("idListBox") loop create a list item if value of the item = selVal then add "selected" to the item add item end loop ... That's it... HainKurt