When requesting an ASP.NET page each time, the server will load an ASP.NET page and uninstall the page when the request is completed. Page and its server controls are responsible for performing requests and presenting HTML to the client. Although communication between clients and servers is stateless and intermittent, it is necessary to make the customer feel that this is a continuous execution process.
This continuous illusion is implemented by the ASP.NET page framework, page and its control. After returning, the behavior of the control must appear to begin from the end of the last Web request. Although the ASP.NET page framework can make the execution state management is relatively easy, in order to obtain continuous effects, the control developer must know the execution order of the control. Control developers need to know: What information can be used in the control life cycle, which data can be used, which is held when the control is presented. For example, the control cannot call its parent before the control tree on the population page.
The following table provides advanced overview of each stage in the control life cycle. For more information, click on the link in the table.
The method or event initialization initialization of the operation to be overwritten in phase control needs to initialize the settings required in the incoming Web request lifecycle. See Handling Inherited Events. INIT Event (OnInit Method) Loading View Status At the end of this phase, you will automatically populate the ViewState properties of the control, see Introduction to the status in the maintenance control. The control can rewrite the default implementation of the loadViewState method to restore custom status. The loadViewState method handles the return data processing incoming form data and updates the property accordingly. See Processing Returning Data.
Note that only controls that process the return data are involved in this stage.
LoadPostData method (if IPOSTBACKDATAHANDAL) is loaded to load all requests, if the database query is set. At this point, the server control in the tree has been created and initialized, the state is restored and the form control reflects the client's data. See Handling Inherited Events. LOAD Event (OnLoad Method) Sends a return change notification to raise changes between changes between the current and previous rapids. See Processing Returning Data.
Note that only controls that trigger a return change event participate in this phase.
RaisePostDataChangeDevent Method (If IPostBackDataHandler) Processing Retreat Process Processing Circular Events Circular Events and triggering the corresponding events on the server. See capturing a rapid process.
Note that only controls that process the retrace event participate in this phase.
The RaisePostBackevent method (if you have IPOSTBACKEVENTHANDLER) pre-pre-predicted any updates before rendering output. You can save the changes made to the control status during the pre-presentation phase, and the changes in the rendering phase will be lost. See Handling Inherited Events. Prerender Event Save Status After this phase, keep the Control's ViewState property in the string object. This string object is sent to the client and sent back as a hidden variable. To improve efficiency, the control can override the SaveViewState method to modify the ViewState property. See the status in the maintenance control. The SaveViewState method presents generation to present the output to the client. See Rendering ASP.NET Server Control. The render method disposes all the final cleaning operations before the destruction control. The reference to expensive resources must be released at this stage, such as database links. See the method in the ASP.NET server control. Dispose method Uninstall all final cleaning operations before performing destruction controls. Controls The authors are typically cleared in Dispose without processing this event. UNLOAD event (on unload method)
Pay attention to override
Eventname event, please rewrite
On
Eventname method (and call base.
On
Eventname). The methods and events in the third column are inherited from system.web.ui.control, but the following except: LoadPostData and RaisePostDataChangeDevent are methods for the iPostBackDataHandler interface, while RaisePostBackevent is the iPostBackeVentHandler interface. If the control is involved in the return data processing, IPOSTBACKDATAHANDLER must be implemented. If the control receives a rapid event, you must implement iPostBackeventHandler.
The CreateChildControls method is not listed in the table because whenever the ASP.NET page framework needs to create a control tree, this method is called, and the method call is not limited to a specific phase of the control lifecycle. For example, you can call CreateChildControls during the binding data during the load data or during the rendering process.