Asp. NET control's execution lifecycle

Source: Internet
Author: User
Tags object execution final net string client

Stage

Actions that the control needs to perform
The method or event to override
Class
Initializes the settings that are required within the life cycle of the incoming WEB request.
Init Event (OnInit method)
Load View state
At the end of this phase, the control's ViewState property is automatically populated, and the control can override the default implementation of the LoadViewState method to customize the state restore.
LoadViewState method
Processing postback data
Process incoming form data and update the properties accordingly.
Note: Only controls that process postback data are involved in this phase.
LoadPostData method (if IPostBackDataHandler is implemented)
Load
Perform actions that are common to all requests, such as setting up a database query. At this point, the server control in the tree has been created and initialized, the state has been restored, and the form control reflects the client's data.
Load Event (OnLoad method)
Send a postback change notification
Raises a change event to respond to a state change between the current and the previous postback.
Note: Only controls that raise postback change events are involved in this phase.
RaisePostDataChangedEvent method (if IPostBackDataHandler is implemented)
Handling Postback Events
Handles the client event that caused the postback and raises the appropriate event on the server.
Note: Only controls that handle postback events participate in this phase.
RaisePostBackEvent method (if IPostBackEventHandler is implemented)
Pre-rendering
Performs any updates before rendering the output. You can save changes to the state of the control at the present stage, and changes that are made to the rendering phase are lost.
PreRender Event (OnPreRender method)
Save state
After this phase, the control's ViewState property is automatically persisted to the string object. This string object is sent to the client and sent back as a hidden variable. To improve efficiency, controls can override the SaveViewState method to modify the ViewState property.
SaveViewState method
Present
Generates output that is rendered to the client.
Render method
Disposal
Performs all final cleanup operations before destroying the control. References to expensive resources, such as database links, must be released at this stage.
Dispose method
Unloading
Performs all final cleanup operations before destroying the control. Control authors typically perform cleanup in Dispose without handling this event.
UnLoad event (on UnLoad method)


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.