ASP.NET Page Life Cycle Events

The page raises some events at each stage of the page lifecycle, which can be coded.

Following are the page life cycle events

PreInit:
The PreInit is the first event in page life cycle of ASP.NET . This event checks the IsPostBack property and determines whether the page is a postback or not . It sets the themes and master pages, creates dynamic controls and gets and sets profile property values. This event can be handled by overloading the OnPreInit method or by creating a Page_PreInit handler.
Init:
The Init event initializes the control property and the control tree is created. This event can be handled by overloading the OnInit method or by creating a Page_Init handler.
InitComplete:
The InitComplete event allows a user to track the view state.
LoadViewState:
The LoadViewState event allows the users to load view state information into the controls.
LoadPostData :
The LoadPostData event processed the contents of all the input fields defined with the “form” tag.
PreLoad:
The PreLoad event occurs before the post back data is loaded in the controls. This event can be handled by overloading the OnPreLoad method or by creating a Page_PreLoad handler.
Load:
The Load event is raised first for the page and then for all child controls. At this stage,the controls are created in the control tree. This event can be handled by overloading the OnLoad method or by creating a Page_Load handler.
LoadComplete:
The LoadComplete event completed the loading process and at the same time control event handlers are run and page validation takes place. This event can be handled by overloading the OnLoadComplete method or by creating a Page_LoadComplete handler.
PreRender:
The PreRender event occurs just before the output is generated. In this event, the pages and controls can perform any updates before the output is generated.
PreRenderComplete:
The PreRender event is recursively fired for all child controls.This event make sure the completion of the pre-rendering phase.
SaveStateComplete:
This event saves the State of control on the page as well as Personalization, control state and view state information. The HTML markup is generated. This event can be handled by overriding the Render method or by creating a Page_Render handler.
UnLoad:
The UnLoad event is the last event of the page life cycle. It raises the UnLoad event for all controls recursively and at the end for the page itself. This event can be handled by modifying the OnUnLoad method or by creating a Page_UnLoad handler.

Scroll to Top