ASP. C # master page and content page event typesetting load order life cycle

Source: Internet
Author: User

ASP. C # master page and content page event typesetting load order life cycle

About ASP page Page_Load occurred before the event caused by the problem has been loved, the explanation of the problem is also very comprehensive, but how to solve the problem is less people say, I will

Simply explain the solution. The following is the order of events for the content and master pages (if any):
Contentpage.preinit
Master.init
Contentpage.init
Contentpage.initcomplite
Contentpage.preload
Contentpage.load
Master.load
Contentpage.loadcomplete
Contentpage.prerender
Master.prerender
Contentpage.prerendercomplete

Even if the order of occurrence is not good for the novice, the following emphasis will come:
We will find a protected void Page_Load (object sender, EventArgs e) method in the background of the page
It is common for people to write the processing code that needs to be done when the page is loaded, but this method occurs before the Click event, causing a lot of minor problems
so is there a way to do it after the event? The answer is yes:
protected void Page_loadcomplete (object sender, EventArgs e)
is it simple? But this method still occurs before the master load, if the pop-up dialog will cause the master layout confusion, then use the following is OK
protected void Page_prerendercomplete (object sender, EventArgs e)

So the life cycle of the problem is solved, the code understanding is much smoother
Here are some of the method execution sequences that will be activated during page loading, which can be used if you want to write code at a specific stage of the page:
protected void Page_Init (object sender, EventArgs e)
protected void Page_Load (object sender, EventArgs e)
Various user-defined control click events
protected void Page_loadcomplete (object sender, EventArgs e)
protected void Page_PreRender (object sender, EventArgs e)
protected void Page_prerendercomplete (object sender, EventArgs e)
protected void Page_Unload (object sender, EventArgs e)
protected void Page_Error (object sender, EventArgs e)
protected void Page_aborttransaction (object sender, EventArgs e)
protected void Page_committransaction (object sender, EventArgs e)
protected void Page_databinding (object sender, EventArgs e)
protected void page_disposed (object sender, EventArgs e)

ASP. C # master page and content page event typesetting load order life cycle

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.