Click here to Skip to main content
14,024,060 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


57 bookmarked
Posted 21 Aug 2012
Licenced CPOL

ASP.NET Page Life Cycle Events

, 21 Aug 2012
Rate this:
Please Sign up or sign in to vote.
A list of events in the ASP.NET page life cycle.


You can:

  • Check for the IsPostBack property to determine whether this is the first time the page is being processed.
  • Create or recreate dynamic controls.
  • Set master page dynamically.
  • Set the Theme property dynamically.
  • Read or set profile property values.

If Request is postback:

  • The values of the controls have not yet been restored from view state.
  • If you set control property at this stage, its value might be overwritten in the next event.


  • In the Init event of the individual controls occurs first, later the Init event of the Page takes place.
  • This event is used to initialize control properties.


  • Tracking of the ViewState is turned on in this event.
  • Any changes made to the ViewState in this event are persisted even after the next postback.


  • This event processes the postback data that is included with the request.


  • In this event the Page object calls the OnLoad method on the Page object itself, later the OnLoad method of the controls is called.
  • Thus Load event of the individual controls occurs after the Load event of the page.


  • This event is used to handle specific control events such as a Button control’s Click event or a TextBox control’s TextChanged event.

In case of postback:

  • If the page contains validator controls, the Page.IsValid property and the validation of the controls takes place before the firing of individual control events.


  • This event occurs after the event handling stage.
  • This event is used for tasks such as loading all other controls on the page.


  • In this event the PreRender event of the page is called first and later for the child control.


  • This method is used to make final changes to the controls on the page like assigning the DataSourceId and calling the DataBind method.


  • This event is raised after each control's PreRender property is completed.


  • This is raised after the control state and view state have been saved for the page and for all controls.


  • The page object calls this method on each control which is present on the page.
  • This method writes the control’s markup to send it to the browser.


  • This event is raised for each control and then for the Page object.


  • Use this event in controls for final cleanup work, such as closing open database connections, closing open files, etc.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Pavan Navule
India India
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionNothing specific Pin
Kumarbs12-Jan-15 1:51
professionalKumarbs12-Jan-15 1:51 
GeneralMy vote of 3 Pin
Murali_asp.net1329-Sep-14 3:28
professionalMurali_asp.net1329-Sep-14 3:28 
QuestionNice article Pin
Er. Dinesh Bhoje17-Jun-14 20:46
memberEr. Dinesh Bhoje17-Jun-14 20:46 
GeneralMy vote of 1 Pin
Rahul VB20-May-14 8:31
professionalRahul VB20-May-14 8:31 
GeneralMy vote of 2 Pin
Sarathkumar Nallathamby2-Dec-13 0:18
professionalSarathkumar Nallathamby2-Dec-13 0:18 
GeneralMy vote of 2 Pin
bojaraj10-Jun-13 1:33
memberbojaraj10-Jun-13 1:33 
GeneralMy vote of 5 Pin
Thanks78722-May-13 20:08
protectorThanks78722-May-13 20:08 
GeneralMy vote of 5 Pin
D-Kishore2-Sep-12 20:39
memberD-Kishore2-Sep-12 20:39 
GeneralMy vote of 5 Pin
Christian Amado22-Aug-12 5:11
professionalChristian Amado22-Aug-12 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190419.4 | Last Updated 21 Aug 2012
Article Copyright 2012 by Pavan Navule
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid