R
Rory Plaire
Hi,
I'm loading a user control (.ascx) with LoadControl in a code-behind
page. LoadControl returns successfully, and the valid reference it
returns is successfully cast to the type of control I need
(TimeEntryGrid). All this is done in Page_Init so that the control can
catch the Page_Load the first time around.
On the first time the page is loaded, I don't actually add the derived
user control to the page control hierarchy, since it is not needed
until the user requests it.
The problem with this: it appears that none of the lifecycle events
are fired for the user control... not even Init. When I add the
control to the Page control hierarchy through a
Control.Controls.Add(), the events are fired as expected.
Why doesn't LoadControl actually Load the Control?
thanks,
-rory 8)
I'm loading a user control (.ascx) with LoadControl in a code-behind
page. LoadControl returns successfully, and the valid reference it
returns is successfully cast to the type of control I need
(TimeEntryGrid). All this is done in Page_Init so that the control can
catch the Page_Load the first time around.
On the first time the page is loaded, I don't actually add the derived
user control to the page control hierarchy, since it is not needed
until the user requests it.
The problem with this: it appears that none of the lifecycle events
are fired for the user control... not even Init. When I add the
control to the Page control hierarchy through a
Control.Controls.Add(), the events are fired as expected.
Why doesn't LoadControl actually Load the Control?
thanks,
-rory 8)