ASP.NET Page Life Cycle
15-July-2009
|
Page Pre Initializing |
Page_PreInit |
Check the IsPostBack property to determine whether this is the first time the page is being processed. Create or re-create dynamic controls. Set a master page dynamically. Set the Theme property dynamically. |
|
Page Initialization |
Page_Init |
Raised after all controls have been initialized. Use this event to read or initialize control properties. |
|
Page Initialization Completed |
Page_InitComplete |
Use this event for processing tasks that require all initialization be complete. |
|
View State Loading |
LoadViewState |
The view state of the control posted by the client is reloaded into the new instance of the control. |
|
Page before Load |
OnPreLoad |
Use this event if you need to perform processing on your page or control before the Load event. |
|
Page Loading |
OnLoad |
The Page calls the OnLoad event method on the Page, then recursively does the same for each child control, which does the same for each of its child controls until the page and all controls are loaded. |
|
Page Load |
Page_Load |
This is not an event instead, at this stage of processing, the OnLoad event calls the Page_Load method. |
|
Loading the postback data |
LoadPostData |
The server searches any data corresponding to the control that is loaded in the data posted by the client. |
|
PostBack Event Handling |
RaisePostBackEvent |
Notifies the server control that caused the postback that it should handle an incoming postback event. |
|
Control Event |
||
|
Page Load Completed |
LoadComplete |
Use this event for tasks that require that all other controls on the page be loaded. |
|
PreRendering |
Page_PreRender |
The PreRender event occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls. |
|
PreRendering Completed |
OnPreRenderComplete |
The OnPreRenderComplete method is called when the prerendering stage of the page life cycle is complete. At this stage of the page life cycle, all controls are created and the page is ready to render the output. |
|
Saving ViewState |
SaveViewState |
Before this event occurs, ViewState has been saved for the page and for all controls. Any changes to the page or controls at this point will be ignored. |
|
Saving ViewState Completed |
OnSaveStateComplete |
The OnSaveStateComplete method is called when the state information for the control has been written to the persistence medium for the page. |
|
Creating HTML |
CreateHtmlTextWriter |
The CreateHtmlTextWriter method creates a TextWriter through the browser property of the request object associated with the page request. |
|
Rendering |
Page_Render |
This is not an event instead, at this stage of processing, the Page object calls this method on each control. All ASP.NET Web server controls have a Render method that writes out the control’s markup that is sent to the browser. |
|
Page Unload |
OnUnload |
Fires immediately before the object is unloaded from the servers memory. |
|
Unloading |
Page_UnLoad |
This event occurs for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections. |