The page raises some events at each stage of the page lifecycle, which can be coded.
Following are the page life cycle events
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.
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.
The InitComplete event allows a user to track the view state.
The LoadViewState event allows the users to load view state information into the controls.
The LoadPostData event processed the contents of all the input fields defined with the “form” tag.
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.
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.
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.
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.
The PreRender event is recursively fired for all child controls.This event make sure the completion of the pre-rendering phase.
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.
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.