(3)InitComplete Raised once all initializations of the page and its controls have been completed. Till now the viewstate values are not yet loaded, hence you can use this event to make changes to view state that you want to make sure are persisted after the next postback

EXAMPLE : Override the event as given below in your code-behind cs file of your aspx page

protected  void Page_InitComplete(object sender, EventArgs e)

{//  Raised by the  Page object. Use this event for processing tasks that require all  initialization be complete. 
}

(4)PreLoad Raised after the page loads view state for itself and all controls, and after it processes postback data that is included with the Request instance

(1)Loads ViewState : ViewState data are loaded to controls

Note : The page viewstate is managed by ASP.NET and is used to persist information over a page roundtrip to the server. Viewstate information is saved as a string of name/value pairs and contains information such as control text or value. The viewstate is held in the value property of a hidden <input> control that is passed from page request to page request.

(2)Loads Postback data : postback data are now handed to the page controls

Note : During this phase of the page creation, form data that was posted to the server (termed postback data in ASP.NET) is processed against each control that requires it. Hence, the page fires the LoadPostData event and parses through the page to find each control and updates the control state with the correct postback data. ASP.NET updates the correct control by matching the control’s unique ID with the name/value pair in the NameValueCollection. This is one reason that ASP.NET requires unique IDs for each control on any given page.

EXAMPLE : Override the event as given below in your code-behind cs file of your aspx page

protected  override void OnPreLoad(EventArgs e)

{//  Use this event if you need to perform processing on your page or control before  the  Load event.
//  Before the Page instance raises this event, it loads view state for itself and  all controls, and then processes any postback data included with the Request  instance.
}

Similar Topics:

Tags:

asp net page life cycle events with exampleasp net page life cycle with examplepage life cycle in asp net with exampleasp net page life cycle in detailasp net life cycle in detailasp net page life cycle examplepagelife cycle in asp net with examplepage life cycle in asp netasp net page life cycle with examplespage life cycle events in asp net with examples