The Page and Control Life Cycle
There are several new events for an ASP.NET page:LoadComplete, which occurs when the page has finished handling postback dataPreInit, which occurs before the Init event for controls on the pagePreLoad, which occurs before the PreLoad event for controls on the pagePreRenderComplete, which occurs after the PreRender event for all controls on the page
The life cycle of events is shown in Chapter 10.)
Phase | Subphase | Adapter Handling | Event/Method | Notes |
---|---|---|---|---|
Start | Detect postback | Yes | Page.DeterminePostbackMode | If there is no ViewState or the posteventSourceID is empty, an initial request is assumed. |
Initialization | Page.PreInit | The place to load Personalization and theme details. | ||
Page.ApplyControlTheme | ||||
Page.ApplyPersonalization | ||||
Yes | Page.InitCtl.Init | |||
Begin tracking ViewState | Ctl.TrackViewState | |||
Page.InitComplete | ||||
Load State | LoadControlState | Ctl.LoadControlState | For controls that require private state. | |
Load ViewState | Yes | Ctl.LoadViewStateRecursive Ctl.LoadViewState | Occurs for each control in the collection. | |
Process post data | Yes | Page.ProcessPostData Ctl.LoadPostData | For controls that implement IPost BackDataHandler. First attempt for the RaisePostback event handler. | |
Load | Page.PreLoad | |||
Yes | Ctl.LoadRecursive Ctl.Load | Occurs for each control in the collection. | ||
Process postback | Yes | Page.ProcessPostData Ctl.LoadPostData | For controls that implement IPost BackDataHandler. Second attempt for RaiseChanged events and Post BackEvent. | |
RaiseCallbackEvent | If the page or control has a callback event handler. | |||
Post back events | RaiseChangedEvents RaisePostBackevent | |||
Page.LoadComplete | ||||
Pre-Render | Create child controls | Ctl.EnsureChildControls | ||
Yes | Ctl.CreateChildControls | |||
Page.PreRenderComplete Page.SavePersonalizationData | ||||
Save State | Save Control State | Ctl.SaveControlState | ||
Save ViewState | Ctl.SaveViewStateRecursive | Occurs for each control in the collection. | ||
Yes | Ctl.SaveViewState | |||
Render | Page.CreateMarkupTextWriterCtl.RenderControlCtl.RenderCtl.RenderChildren | |||
Unload | Page.UnLoadRecursiveCtl.UnLoadRecursiveCtl.Unload | Occurs for each control in the collection. | ||
Yes | Page.UnLoad | |||
Dispose | Ctl.Dispose |