B
Bjorn Sagbakken
With ASP.NET 2.0:
I have managed to create controls dynamically in an asp:table, populating
them with database info, and even adding empty rows of controls for adding
new data to the database. For all this to work I add a ViewState counter, so
far so well.
But I also want to clear the form, remove the controls and remove all
ViewState data. This is done with some code behind a button. I have tried
various kind of commands, and they all work - but I have to hit the
clear-button twice.
My guess goes for timing in the page events. The controls are loaded
dynamically in the page-load event, and I guess the clear-viewstate call
behind my clear-button is executed after this event. This is why I have to
hit the clear-button twice. But how can I make this happen in one single
postback? Any ideas?
Bjorn
I have managed to create controls dynamically in an asp:table, populating
them with database info, and even adding empty rows of controls for adding
new data to the database. For all this to work I add a ViewState counter, so
far so well.
But I also want to clear the form, remove the controls and remove all
ViewState data. This is done with some code behind a button. I have tried
various kind of commands, and they all work - but I have to hit the
clear-button twice.
My guess goes for timing in the page events. The controls are loaded
dynamically in the page-load event, and I guess the clear-viewstate call
behind my clear-button is executed after this event. This is why I have to
hit the clear-button twice. But how can I make this happen in one single
postback? Any ideas?
Bjorn