The lifecycle of pages in ASP. NET 2.0 starts when the ASP. NET runtime environment executes ihttphandler: processrequest
Method. This method sets the internal class of the page, such as the HTTP environment (context), request object, and
Response object.
The next step is to create the control tree defined in the aspx file. Then, determine the page mode (PostBack and callback ).
Cross-page PostBack)
The first triggered event is the preinit event. After the event is returned, the page loads theme)
And load personalized data. In this event, you can do theme and personal information on the page.
Some operations
Page initialization: each page control triggers an init event. The init event of the control is triggered first than the page init event.
End page initialization: An initcomplete event is triggered. After all page controls are initialized
. Happens-the view state of controls is between the init event and the initcomplete event
Set up for tracking. Each control has its trackviewstate method called.
By default, this method sets a flag that instructs the control to track its view
State for changes)
Load control state and view State: in ASP. NET 2.0, the control state is a private view State, each
The control has the responsibility to maintain it. Unlike view state, the control state cannot be changed outside the control by programming, and
Cannot be disabled. The control state is loaded before the view State is loaded. These do not trigger events, but you can use the overload method.
To implement programming.
Load PostBack data: process the PostBack data and compare their IDs with the control IDs.
Update controls.
Page Preloading: After processing submitted data on the page, the preload event is triggered. You can process any
What needs to be done before page loading starts.
Page loading: triggers a load event. This event is first triggered in the control, and finally the page. After the load is complete, the following
Thing: the page will take a moment to match the submitted data and page controls. This job is to load the state to dynamic creation.
If the page has a callback handler, it will be triggered at this time. Finally, if the submitted data changes some controls
The control event will be triggered. For example, if the text attribute of textbox is changed, the textchanged event
.
PostBack event: the server code associated with the client event (for example, click) is executed on the page. At this time, the page enters the output (render)
Phase
Prerendering: Before a prerender event is triggered, the leaf area will confirm that all controls have been successfully created. The prerender event will first
It is triggered on the page and then sequentially in the control. Then, the page's prerendercomplete event is triggered and the personalized data is saved.
Control and view State.
Rendering: Creates the content output to the client. Generally, this event is reloaded to process the output content.
Page unload: triggers the unload event, which is triggered when the Page Object is released.
Unload event is followed by the dispose event, which indicates that
The page object is being destroyed.