Are you familiar with the PreRender event? Try using the PreRender event
instead of page_load to access your control variables. You would still
dynamically assign the controls on the server in page_load. Assuming that
the Custom controls are maintaining its state correctly internally, due to
the Asp.net page event model, the user controls will not have loaded the
retained viewstate until the PreRender event fires (which is after the
page_load event). The effect of this would appear like the control has lost
its state when accessed in page_load. Accessing your control parameters in
the PreRender event may take care of your need to manually reload the
controls.
"su*****@gmail.com" wrote:
Hello,
I am developing a webpage (in .net 2003) that requires several
complicated user webcontrols to load different modules within the page.
Most of these webcontrols are loaded are runtime. Based on some action
(button-click) on these additional custom controls may be added or
removed from the page. The issue I am facing is that I am having to
load these dynamic controls everytime in Page_Load and as a result the
state of the control gets lost. Also, since Page_Load happens before
Button_Click event I am having to do Server.Transfer to reload some of
the data in the page.
Is there any better way to execute this in ASP.Net 1.1?
Thanks.