Partager via


Introduction to the Form Control

Most pages on the World Wide Web are too complex to be displayed on current mobile devices, such as Web phones. The Form mobile control enables you to break up complex pages into a collection of forms on a mobile Web page. With this ability, you can minimize the effort required to port Web-based applications to mobile devices. For more information, see Organizing Content with Containers.

Form Controls in Mobile Web Pages

ASP.NET mobile Web pages can contain more than one Form control. However, when they are displayed on a mobile device, mobile Web applications display only one Form control at a time. When a user browses to a mobile Web page, the first form on that page appears by default. You can set the page's ActiveForm property to specify the current active form. You can also provide the user with links between forms on the same page.

Form controls contain content and other controls. You can think of a Form control as a page within a page. All Form controls on a page share the same code and page-state information. Using multiple forms on a mobile Web page helps reduce the number of physical page files in your application, and thus improves performance at run time.

ASP.NET Form Control

A mobile Web page must contain at least one Form control. All other controls, with the exception of the StyleSheet control, must be placed within a Form control, a Panel control, or a control template.

You can set the Form control's color with the BackColor and ForeColor properties. You can also type literal text directly in a Form control, which will flow around other controls that you add. Format the text using the Bold and Italic properties, which are in the Font property.

Device-Specific Display

Mobile device displays differ widely in their capabilities. To customize the presentation of content and controls for particular mobile devices, you can use a DeviceSpecific control to apply device filters to forms. These enable the use of property override values and control templates.

Your application can handle Form control events to customize the behavior of the Form control. A form raises an Activate event when it becomes the current form. The Deactivate event occurs when it is no longer the active form.

On some mobile devices, if a form's content is long, it can be paginated. Each screen in the paginated form has a current page number. Page numbers begin with 1. The Form control keeps the current page number in its CurrentPage property. When the Form control paginates its content, it also displays user interface elements that enable the user to navigate between the pages. You can set the style of the pagination user interface elements using the Form control's PagerStyle property.

See Also

Tasks

Adding and Configuring a Form Control

Reference

Form

Concepts

Introduction to the DeviceSpecific Control

Introduction to the Panel Control

Organizing Content with Containers