P
Pham Nguyen
I have two maybe related questions about view state and the life cycle
of controls:
1) When does the view state in a control get restored? I thought there
was a LoadViewState event that occured before the Load event when the
view state got restored. However, I have a custom control that
dynamically adds a Label control inside of its OnLoad() method. The
Label still maintains its state across requests -- if the Label is
added in the OnLoad() method of the control, shouldn't it have missed
the LoadViewState event?
2) How are the various life cycle events like Load, LoadViewState,
Init, PreRender invoked? The model I had in my mind was that these
events were raised by ASP.NET at specific points in the execution of a
page and that if a control wasn't present when an event was raised,
that it would miss out on the chance to respond to it. For instance,
the Label control above would not have its LoadViewState() method
called because it was added in the OnLoad() method of its parent,
which occurs in response to the Load event which occurs after the
LoadViewState event. This apparently is very wrong...
of controls:
1) When does the view state in a control get restored? I thought there
was a LoadViewState event that occured before the Load event when the
view state got restored. However, I have a custom control that
dynamically adds a Label control inside of its OnLoad() method. The
Label still maintains its state across requests -- if the Label is
added in the OnLoad() method of the control, shouldn't it have missed
the LoadViewState event?
2) How are the various life cycle events like Load, LoadViewState,
Init, PreRender invoked? The model I had in my mind was that these
events were raised by ASP.NET at specific points in the execution of a
page and that if a control wasn't present when an event was raised,
that it would miss out on the chance to respond to it. For instance,
the Label control above would not have its LoadViewState() method
called because it was added in the OnLoad() method of its parent,
which occurs in response to the Load event which occurs after the
LoadViewState event. This apparently is very wrong...