ASP. NET page event execution sequence

Source: Internet
Author: User

After the preparation, I accidentally saw a similar article on the Internet.ArticleAnd is also very exciting. reposted below for your reference. I declare that the following content is reprinted and cannot be verified by the author or source for some reason. The author of this article does not have the copyright of the following content.

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. prerendercompletemasterpage. 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
Related Article

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.