ASP. NET page (master page) load order

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.