HighTechTalks DotNet Forums  

UserControl ViewState with dynamic child controls

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss UserControl ViewState with dynamic child controls in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ejstembler
 
Posts: n/a

Default UserControl ViewState with dynamic child controls - 03-01-2006 , 04: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?

TIA.


Reply With Quote
  #2  
Old   
DWS
 
Posts: n/a

Default RE: UserControl ViewState with dynamic child controls - 03-02-2006 , 09:28 AM






ejstembler,

Try putting the save button in the user control.

Good Luck
DWS

"ejstembler" wrote:

Quote:
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?

TIA.



Reply With Quote
  #3  
Old   
ejstembler
 
Posts: n/a

Default Re: UserControl ViewState with dynamic child controls - 03-02-2006 , 02: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...


DWS wrote:
Quote:
ejstembler,

Try putting the save button in the user control.

Good Luck
DWS

"ejstembler" wrote:

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?

TIA.




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.