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 data

  • PreInit , which occurs before the Init event for controls on the page

  • PreLoad , which occurs before the PreLoad event for controls on the page

  • PreRenderComplete , which occurs after the PreRender event for all controls on the page

The life cycle of events is shown in Table 9.9. This table covers both public and private events so that the interaction between page and control events can be seen. Page corresponds to a page event, and Ctl corresponds to a control event. New events are shown in bold. The phase and subphase are logical and do not exist as physical events or phasesthey are purely to show the stage in the life cycle. The Adapter Handling column indicates which phases involve the device adapter. (Device adapters are covered in Chapter 10.)

Table 9.9. The Page and Control Life Cycle

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

Load

Control

State

 

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.CreateMarkupTextWriter

Ctl.RenderControl

Ctl.Render

Ctl.RenderChildren

 

Unload

   

Page.UnLoadRecursive

Ctl.UnLoadRecursive

Ctl.Unload

Occurs for each control in the collection.

   

Yes

Page.UnLoad

 
 

Dispose

 

Ctl.Dispose

 


A First Look at ASP. NET v. 2.0 2003
A First Look at ASP. NET v. 2.0 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net