Copy codeThe Code is as follows: # Step 6 of the region control event
Protected void button#click (object sender, EventArgs e)
{
// Use these events to process specific control events, such as Click events of the Button control or TextChanged events of the TextBox Control.
// Note
// In the send-back request, if the Page contains the verification program control, check the IsValid attribute of the Page and each verification control before performing any processing.
}
# Endregion
# Region OnLoadComplete Step 7
Protected override void OnLoadComplete (EventArgs e)
{
// Use this event for tasks of all other controls on the page to be loaded.
Base. OnLoadComplete (e );
}
# Endregion
# Region OnPreRender Step 8
Protected override void OnPreRender (EventArgs e)
{
// Before the event:
// The Page Object calls EnsureChildControls for each control and Page.
// The DataBind method is called for each data binding control with the performanceid attribute set. For more information, see the data binding event of the data binding control below.
// A PreRender event occurs for each control on the page. Use this event to make the final changes to the page or its control content.
Base. OnPreRender (e );
}
# Endregion
# Region SaveStateComplete Step 9
Protected override void OnSaveStateComplete (EventArgs e)
{
// ViewState is saved for the page and all controls before this event occurs. Any changes made to the page or control at this time will be ignored.
// Use this event to execute tasks that meet the following conditions: the view status is saved, but no changes are made to the control.
Base. OnSaveStateComplete (e );
}
# Endregion
# Region Render step 10
// Render
// This is not an event. At this stage of processing, the Page object calls this method on each control. All ASP. NET Web server controls have a Render method used to write the control flag sent to the browser.
// If you create a custom control, you usually need to override this method to output the control tag. However, if the custom control only merges the standard ASP. NET Web server control and does not merge the custom tag, the Render method is not required. For more information, see develop custom ASP. NET Server controls.
// The user control (. ascx file) is automatically merged and rendered, so you do not need to explicitly present the control in the code.
# Endregion
# Region OnUnload Step 1
Protected override void OnUnload (EventArgs e)
{
// This event first occurs for each control and then for this page. In the control, use this event to perform final cleaning on the specific control, for example, closing the connection to the specific database of the control.
// For the page itself, use this event to perform the final cleaning, for example, closing the opened file and database connection, or completing logging or other request-specific tasks.
// Note
// When the page and its control are displayed, no further changes can be made to the response stream. If you try to call a method (such as the Response. Write method), this page will cause an exception.
Base. OnUnload (e );
}
# Endregion
}
When the page is sent back, if you click the button, all the above events will be re-executed. The execution order is as follows:
1. OnPreInit
2. OnInit
3. OnInitComplete
4. OnPreLoad
5. Page_Load
6. OnLoad
7. Button_Click
8. OnLoadComplete
9. OnPreRender