What does Prerender() do?
Collapse
X
-
Hi
MSDN :
Raised after the Page object has created all controls that are required in order to render the page, including child controls of composite controls. (To do this, the Page object calls EnsureChildCont rols for each control and for the page.)
The Page object raises the PreRender event on the Page object, and then recursively does the same for each child control. The PreRender event of individual controls occurs after the PreRender event of the page.
Use the event to make final changes to the contents of the page or its controls before the rendering stage begins.
-
The PreRender event is the last stage in the ASP.NET Life Cycle that you have access to the controls on your page (or within your user control). At point all of the control event code has been executed so you can check the states of all of your controls and do things accordingly.
I use the PreRender event quite often...it's very useful.
Please note, though, that the PreRender event for a control/user-control is only called if the control is being rendered. If the control's Visible property is set to False, the event is not called.
-FrinnyComment
Comment