ASP. NET 5-processing process

Source: Internet
Author: User

Order of event processing for loading content pages and master pages

The final access result page actually accesses the content page and master page. As two closely related pages, they must handle their own initialization and loading events. This process can be illustrated in general:

The process for loading master pages and content pages is as follows. Through these eight processes, we can see that the initialization and loading of master pages and content pages overlap each other. These 8 processes correspond to 11 specific events. As follows:

    1. The init event of the control on the master page;
    2. Init event of the content control on the content page;
    3. Master page init event;
    4. Content Page init event;
    5. Content Page load event;
    6. Master page load event;
    7. Load event of the content control on the content page;
    8. Content Page prerender event;
    9. Master page prerender event;
    10. Master page control prerender event;
    11. The prerender event of the content control on the content page;

We can see that the same event is triggered on the Content Page and master page. For example, both events trigger the init, load, and prerender events. The general rule for triggering events is that the initialization init event is triggered from the innermost control (master page) to the outermost control (Content Control and content page, all other events are triggered from the outermost control to the innermost control. It must be clear that the master page is merged into the content page and is regarded as a control in the content page.

For pages that do not contain a master page, the process is as follows:

Preinit

Init, initcomplete

Preload

Load, loadcomplete

Prerender, prerendercomplete

Savestatecomplete

Unload

:

During the first page loading, the lifecycle includes the following steps:

  1. Run the constructor. This is the first step in the lifecycle of any widget on a page or page.
  2. Determine the return mode. It is the first loading, self-return, or cross-page return.
  3. Pre-initialization. This step is required to determine the target device before the first page initialization. Preinit is the first event in the lifecycle. This event uses the onpreinit method to process the event.
  4. Load and initialize personalized themes
  5. Initialization. InInitializationBuild Control tree in stages. At this stage, any value can be initialized for the request. The oninit method for processing the init event can be used to modify the initialization phase.
  6. Pre-load. This occurs before the returned data is loaded into the control. The onpreload method for processing the preload event can be used to modify the current phase.
  7. Load. In this phase, the userCodeRun. The Form Control displays client data. View status data is available. You can also access controls in the page control hierarchy. The onload method for processing the load event can be used to modify the loading phase.
  8. Loading completed. Complete the loading process. The onloadcomplete method for processing the loadcomplete event can be used to modify this stage.
  9. Pre-rendering. This is a stage before output rendering. The onprerender method for processing the prerender event can be used to modify the current phase.
  10. Save status. Personalization, controls, views, and page status information are saved.
  11. Rendering. In this phase, the output of the page and its control is HTML. You can use the render method for rewriting. In the render method, if necessary, you can call the createchildcontrols method to create and initialize the Server Control in the control tree.
  12. Uninstall. This is the final stage of the lifecycle. This stage provides an opportunity to complete the final cleanup and release resources that consume resources, such as database connections. This is very important for scale. You can use the onUnload method for processing.

During the return period, the following are different from the first loading:

    1. Load Status. After initialization, load the page and control status, and load the view status from a hidden variable on the page.
    2. Process the returned data. In this phase, the POST method is used to process the data sent to the server. The loadpostdata method can be used to update the view status to be returned.
    3. Pre-load and load. This is the same as loading for the first time.
    4. Send a notification of return changes. If the current status changes from the previous status, the change event is triggered using the raisechangedevents method. The trigger sequence is the same as that of the control tree.
    5. Handle the return event. Specifically, user behavior causes the return. After all change events are handled, user behavior is processed. The original client event that is returned is processed in the raisepostbackevent method.
    6. Loading completed. From here, it is the same as loading for the first time.
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.