Partilhar via


Life Cycle of an ASP.NET Mobile Web Page

The life cycle of a Microsoft ASP.NET mobile Web page and its controls is similar to the life cycle of a standard ASP.NET Web page. The following section describes similarities and differences between them. For more information about the life cycle of an ASP.NET Web page, see ASP.NET Life Cycle.

Note

The life cycle of an ASP.NET mobile control is the same as the life cycle of a mobile Web page.

For information about the life cycle and interaction between controls and their associated adapters, see Control and Adapter Interaction, Types of Adapters, and Adapter Interaction with ASP.NET.

Life Cycle Stages for a Mobile Web Page

The following table lists life-cycle stages of a mobile Web page and information about its controls. This information primarily describes the differences in the life cycle of a mobile Web page or mobile control from those described for a non-mobile ASP.NET page. For complete documentation about the ASP.NET life-cycle stages, see ASP.NET Life Cycle.

ASP.NET page life-cycle stage

Mobile page life-cycle stage

Methods or events to override

Initialize

Device adapters are chosen using the mobileControls element in the Web.config file.

Device-specific customizations are applied.

OnInit method

OnInit method

Load view state

Same as non-mobile ASP.NET pages.

LoadViewState method

Process postback data

Same as non-mobile ASP.NET pages.

LoadPostData method

Load

The MobileControl base class instance calls the control's OnLoad method to load device adapter–specific information.

OnLoad method

OnLoad method

Send postback change notifications

Same as non-mobile ASP.NET pages.

RaisePostDataChangedEvent method

Handle postback events

Same as non-mobile ASP.NET pages.

RaisePostBackEvent method

Pre-render

Pagination is performed. The number of items on the page is determined, unless a virtual count is specified through the ItemCount property.

ItemWeight property

OnPreRender method

Save state

Same as non-mobile ASP.NET pages.

SaveViewState method

Render

The adapter accesses and renders child controls in the appropriate order.

The ASP.NET page framework renders each control by calling the Render method of its adapter.

Render method

Render method

Unload (Dispose)

Device adapter-specific cleanup and unloading is performed.

Dispose method

OnUnload method

See Also

Reference

MobileControl

ItemCount

Concepts

Control and Adapter Interaction

Types of Adapters

Other Resources

ASP.NET Life Cycle

Developing ASP.NET Mobile Web Pages