I am adding HTML input controls on the page dynamically via a “add text box” button but after post back eventually they are being washed away. Is there an easy and good practice which can help me keep the controls and their values after page post back.
Thanks.
Edit :
- I am using Javascript to create dynamic controls on the page
- I am not dealing with File Uploads, just creating custom field things.
I think I need to override SaveViewState and LoadViewState events to keep my controls in the ViewState.
See followings:
http://urenjoy.blogspot.com/2009/02/add-dynamic-buttons-and-handle-click.html
You need to override SaveViewState and LoadViewState methods to save after postback, See following sample
http://urenjoy.blogspot.com/2009/03/create-dynamic-dropdownlists-in-aspnet.html
and To retrieve value see following example:
http://urenjoy.blogspot.com/2009/02/retrieve-value-of-dynamic-controls-in.html