The event will be activated in the following order in Page execution:
Page.preinit
Page.Init
Page.initcomplite
Page.preload
Page.load
Page.loadcomplete
Page.prerender
Page.prerendercomplete
If a page inherits from another page, such as BasePage:System.Web.UI.Page, and some extensions are made in basepage, such as permission checking, and other pages inherit from BasePage, then the event activation order for 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, events in MasterPage and events 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
Further, if Contentpage inherits BasePage, then the order of execution of each event becomes:
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
Browsing down to find out is not what I'm learning now, ASP. NET 1.1, estimated to be ASP. NET 2.0,
But it doesn't matter, it makes me know that they have inherited the order of loading.
That is, load the inheritance page first, load its own, and if the inheritance page has inheritance, load the inheritance of the inherited page first.
is actually a very simple content. Write the page event by the way (I don't know if 1.1 is all that)
Event handler Name |
Time of Occurrence |
Page_Init |
Loads the server control and initializes it in the view state of the Web form. This is the first step in the Web Forms life cycle |
Page_Load |
The Page object is uploaded into the server control. Because the view state information is available at this time, As a result, you can use code to change the settings of a space or to display text on a page. |
Page_PreRender |
The application will render the Page object |
Page_Unload |
Pages are unloaded from memory |
Page_Error |
An unhandled exception occurred |
Page_aborttransaction |
Transaction is terminated |
Page_committransaction |
Transaction processing is accepted |
Page_databinding |
Load the server space and data source bindings on the page |
Page_disposed |
The Page object is freed from memory. This is the last event in the Page object life cycle |
For your safety, please only open URLs with reliable sources
Open Site Cancellation
From: http://hi.baidu.com/qgbmxxf/blog/item/0a1bac54595403143b29353f.html
ASP. NET page (master page) load order