The customer sends a POST request-> Create a page derived class and call the constructor-> call ihttphandler. processrequest of the page class Method -> Activate the init event of the page class-> call the createchildcontrols virtual method of the page class-> restore the control status on the server from the post variable and viewstate-> activate the load event of the page class-> -〉 activate the control event on the server-> activate the prerender event of the page class-> call the render virtual method of the page class-> call the renderchildren virtual method of the page class-> send an HTTP response Customer Terminal-> activate the unload event of the page class-> discard the instance of the page derived class.
The page will be activated in the following order:
Page. preinit
Page. init
Page. initcomplite
Page. Preload
Page. Load
Page. loadcomplete
Page. prerender
Page. prerendercomplete
If a page is inherited from a page, such as basepage: system. web. UI. page, some extensions are made in the basepage, such as permission check. When other pages inherit from the basepage, the order of activation of the events of the basepage and the final page is:
Ui. preinit
Page. preinit
Ui. init
Page. init
Ui. initcomplite
Page. initcomplite
Ui. Preload
Page. Preload
Ui. Load
Page. Load
Ui. loadcomplete
Page. loadcomplete
Ui. prerender
Page. prerender
Ui. prerendercomplete
Page. prerendercomplete
If masterpage is used, the events in masterpage and those in contentpage are activated in the following order:
Contentpage. preinit
Master. init
Contentpage. init
Contentpage. initcomplite
Contentpage. Preload
Contentpage. Load
Master. Load
Contentpage. loadcomplete
Contentpage. prerender
Master. prerender
Contentpage. prerendercomplete
Furthermore, if contentpage inherits the basepage, the execution sequence of each event is changed:
Ui. preinit
Contentpage. preinit
Master. init
Ui. init
Contentpage. init
Ui. initcomplite
Contentpage. initcomplite
Ui. Preload
Contentpage. Preload
Ui. Load
Contentpage. Load
Master. Load
Ui. loadcomplete
Contentpage. loadcomplete
Ui. prerender
Contentpage. prerender
Master. prerender
Ui. prerendercomplete
Contentpage. prerendercomplete
ASP. NET 2.0 page event execution sequence masterpage. masterusercontrol_ontop.ascxpage.aspxusercontrol_inpage.ascxusercontrol_onbuttom.ascx
Masterpage |
Usercontrolontop |
Page |
Usercontrolinpage |
Usercontrolonbuttom |
|
Init |
|
|
|
|
|
|
Init |
|
|
|
|
|
Init |
Init |
|
|
|
|
|
|
Init |
|
|
|
|
Load |
|
|
Load |
|
|
|
|
|
Load |
|
|
|
|
|
|
Levels |
|
|
|
|
|
Load |
Controlevents |
Controlevents |
Controlevents |
Controlevents |
Controlevents |
|
|
Prerender |
|
|
Prerender |
|
|
|
|
|
Prerender |
|
|
|
|
|
|
Prerender |
|
|
|
|
|
Prerender |
|
Unload |
|
|
|
|
|
|
Unload |
|
|
|
|
|
Unload |
Unload |
|
|
|
|
|
|
Unload |
|
|