This documentation is archived and is not being maintained.

Form Class

Provides the capability to group controls together.

Namespace:  System.Web.UI.MobileControls
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

public class Form extends Panel implements ITemplateable, IPostBackEventHandler
<mobile:Form />

A form represents the outermost grouping of controls within an ASP.NET mobile Web page. An individual mobile Web page can contain multiple forms at the outermost level. Forms cannot be nested; use Panel controls if you want to nest containers. For more information, see Introduction to the Form Control. To display a specific form, either set the ActiveForm property on the current page to the desired form, or set the NavigateUrl property in a Link control to the desired form. You can include literal text along with its accompanying markup tags in the text contents of the Form control. When using templates, it is important to remember that the Form control creates instances of templates in the OnInit method for the form. The OnInit method for the form is called before Page_Load and Page_Init. Also, the page constructor executes too early to set templates in the OnInit method because the form is not yet created. To correct this, hook the form's own OnInit method, and create an instance of the template there. For more information, see Implementing Templated Rendering.

The following code example shows how to create a page with two forms along with links between the two forms. One form has a check box list. When items are selected and the Submit button is clicked, the form presents a list of the selected items and their values. Notice that the Activate event methods prepare the respective forms for display


The following code example uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code example must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Syntax Overview

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1