UserControl ViewState with dynamic child controls - 03-01-2006 , 05:44 PM
I have a custom UserControl where the content is dynamically generated
when the containing Page calls a certain method (i.e. DisplayData).
The content of the UserControl is a dynamically generated Table with
several Rows and several Cells. Some of the Cells contain a TextBox
which the end-user can type text into. The Page which contains this
UserControl has a "Save" button which generates a post-back.
The problem I'm having... When the end-user presses the "Save" button a
post-back is generated, however, the UserControl's table is empty. I
can save the table in the Session after generating it, but that doesn't
give me access the the text from TextBoxes.
Anyone know the proper way to do this?
RE: UserControl ViewState with dynamic child controls - 03-02-2006 , 10:28 AM
Try putting the save button in the user control.
Re: UserControl ViewState with dynamic child controls - 03-02-2006 , 03:07 PM
I cannot do that in this case.
I see that this is a common issue after reading several posts here and
the other ASP.Net newsgroups. Unfortunaly, I didn't find a solution.
Basically I have a composite Control which dynamically generates child
controls via CreateChildControls. However the this.Controls collection
is empty after a post-back is fired and then CreateChildControls is
eventually re-called. I just need to find a way to get the child
controls to persist...
|Thread Tools||Search this Thread|