ASP.net control Development Series II

Source: Internet
Author: User

"Order of life and death."

"Install grandchildren."

The last article, "opening" said a lot of empty theory, this article I would first say "Grand" things: 1, asp.net control (including the page itself) the life of the details; 2, how to start the writing of a control.

"Order of life and death."

How does the ASP.net handler, after receiving a user's page request, conjure up a live page to the client? What has it done? In what order?

To illustrate this issue, we first need to understand that a page itself is also a control. From the perspective of design patterns, the page model is a "synthetic mode" (composite), which is itself a structure tree composed of multiple layers of controls, the top layer is page, and the following leaves have branches, leaves are controls that no longer contain child controls, and branches are controls that contain child controls. Each layer of the control's build invokes a method that generates the child control, the parent control invokes the child control's generation method, and the child invokes the grandchild, so recursively, to ensure that all valid (and generally visible=true) controls in the page are processed by the build process, (about the design pattern of things you can view the Lu Zhenyu teacher in the blog Park design Pattern series article, this series is to Dr Yan "Java and the Model" a book (88 yuan, very thick) refining and processing, at least can be used to do the design model shallow level of the teaching material), Each control generally includes the following steps in its lifecycle:

1. Instantiation (Instantiate)

We write controls generally do not touch this activity.

2. Initialization (Initialize)

Ditto.

3. Trace view (Tracking view state) *

This is more important, it involves view state, and in general you do not have to overload this method.

4. Load View status (Load view state) *

This method is invoked only during the return process, as above.

5. Load postback data (load) *

If your control is generated to interact with the client, this method is important and will only be invoked during the return process.

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.