I have stumbled across a problem with my asp.net form.
Within my form the end user chooses a number of textboxes to be dynamically created, this all works fine
The issue is these text boxes need recreated in the Load
event of the page, every single time, so that both events and values can be hooked back up and retrieved.
I think the most straight forward approach, in your case, would be to extend idea #1 that you had already tried. Build a List
of these controls with enough information to recreate them in Load
, but you need to store that List
in either ViewState
or Session
.
ViewState["DynamicControls"] = list;
or
Session["DynamicControls"] = list;
I would use ViewState
if you can because it gets destroyed when the user leaves the page.