Asp. NET Simple Series 2-page life cycle detailed

Source: Internet
Author: User

The last series describes the overall process of the page lifecycle, and perhaps some readers would like to learn more about the details of the entire lifecycle, which I cannot talk about in all the details or need, and here are just a few examples of how the page life cycle can be studied.

The control class has the following events

Occurs when a server control is bound to a data source.

public event EventHandler DataBinding;

Occurs when a server control is freed from memory, which is the last stage of the server control's lifetime when a asp.net page is requested.

public event EventHandler disposed;

Occurs when a server control initializes, and initialization is the first step in the lifetime of the control.

public event EventHandler Init;

Occurs when the server control is loaded into the System.Web.UI.Page object.

public event EventHandler Load;

Occurs after the System.Web.UI.Control object is loaded, before rendering.

public event EventHandler PreRender;

Occurs when a server control is unloaded from memory.

public event EventHandler Unload;

Because each page and most of the book controls are inherited from this control class, they can all register these events if we provide the corresponding name of the method, ASP. NET at compile time will help us register the corresponding method to the event, for example, if we write the following method in the page

protected void Page_Init (object sender, EventArgs e)
{
trace.write ("Page_Init");
}

The asp.net will register this method at compile time in the control class Init event, which will call this Page_Init method when the page is initialized. We right-click the page class "Select to define" menu to see the definition of page, there are some events in this definition

Occurs when the page initialization completes.

public event EventHandler InitComplete;

Occurs at the end of the load phase of the page life cycle.

public event EventHandler LoadComplete;

Occurs at the beginning of page initialization.

public event EventHandler PreInit;

Occurs before the page System.Web.UI.Control.Load event.

public event EventHandler preload;

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.