device Element for mobileControls (ASP.NET Settings Schema)

Defines a new adapter set that maps ASP.NET mobile controls to corresponding adapters within the system.web Element (ASP.NET Settings Schema) and <mobileControls> sections of the Web.config configuration file.

configuration Element (General Settings Schema)
  system.web Element (ASP.NET Settings Schema)
    mobileControls Element (ASP.NET Settings Schema)
      device Element for mobileControls (ASP.NET Settings Schema)

<device name="String" 
        inheritsFrom="String" " 
        pageAdapter="String" 
        predicateClass="String" 
        predicateMethod="String>
    <control.../>
</device>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

name

Required String attribute.

Specifies the unique name by which you must identify the device adapter set.

inheritsFrom

Optional String attribute.

Specifies the device adapter set from which this set must inherit. The specified device adapter set can appear either earlier in the same <mobileControls> section, or in the <mobileControls> section of a higher-level configuration file.

pageAdapter

Optional String attribute.

Specifies the class type of the page adapter for the adapter set. The specified class must implement the IPageAdapter interface. The name must follow the .NET Framework standards for specifying a fully qualified type name.

ASP.NET searches the specified assembly for the type. If the adapter set inherits from another adapter set, the pageAdapter attribute is not necessary and will default to the parent set's value.

predicateClass

Optional String attribute.

Specifies the class type that supplies the evaluator predicate. The name that you use for the class type must follow the .NET Framework standards for specifying a fully qualified type name.

ASP.NET searches the specified assembly for the type. If the adapter set inherits from another type, the predicateClass attribute is not necessary and will default to the parent set's value.

predicateMethod

Optional String attribute.

Specifies the method that supplies the evaluator predicate. The method must be static, and of the following signature:

static bool EvaluatorMethod(HttpContext context)

If the adapter set inherits from another adapter set, the predicateMethod attribute is not necessary, and will default to the parent set's value.

Child Elements

Element

Description

control

Maps an ASP.NET mobile control to a specific device adapter.

Parent Elements

Element

Description

configuration

The required root element in every configuration file used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration settings in a configuration file. Contains elements that configure ASP.NET Web applications and control how the applications behave.

mobileControls

Defines adapter sets that map ASP.NET mobile controls to corresponding adapters within the system.web Element (ASP.NET Settings Schema) section of the Web.config file.

Remarks

If a <device> section includes the inheritsFrom attribute, you do not need to declare the predicateClass, predicateMethod, or pageAdapter attribute. Instead, your device adapter set can inherit these from the parent device-adapter set definition.

Note

Although these attributes are not necessary, you can define them if it is appropriate for your application.

You can place any number of control sections or elements within an adapter set, each providing a specific control adapter mapping (a class that implements IControlAdapter).

Default Configuration

The following default <mobileControls> element is configured in the root Web.config file in the .NET Framework version 2.0.

<mobileControls sessionStateHistorySize="6" 
  cookielessDataDictionaryType="System.Web.Mobile.CookielessData">
  <device name="XhtmlDeviceAdapters" 
    predicateClass="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlPageAdapter" 
    predicateMethod="DeviceQualifies" 
    pageAdapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlPageAdapter">
    <control name="System.Web.UI.MobileControls.Panel" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlPanelAdapter" />
    <control name="System.Web.UI.MobileControls.Form" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlFormAdapter" />
    <control name="System.Web.UI.MobileControls.TextBox" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlTextBoxAdapter" />
    <control name="System.Web.UI.MobileControls.Label" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlLabelAdapter" />
    <control name="System.Web.UI.MobileControls.LiteralText" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlLiteralTextAdapter" />
    <control name="System.Web.UI.MobileControls.Link" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlLinkAdapter" />
    <control name="System.Web.UI.MobileControls.Command" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlCommandAdapter" />
    <control name="System.Web.UI.MobileControls.PhoneCall" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlPhoneCallAdapter" />
    <control name="System.Web.UI.MobileControls.List" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlListAdapter" />
    <control name="System.Web.UI.MobileControls.SelectionList" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlSelectionListAdapter" />
    <control name="System.Web.UI.MobileControls.ObjectList" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlObjectListAdapter" />
    <control name="System.Web.UI.MobileControls.Image" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlImageAdapter" />
    <control name="System.Web.UI.MobileControls.ValidationSummary" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlValidationSummaryAdapter" />
    <control name="System.Web.UI.MobileControls.Calendar" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlCalendarAdapter" />
    <control name="System.Web.UI.MobileControls.TextView" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlTextViewAdapter" />
    <control name="System.Web.UI.MobileControls.MobileControl" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlControlAdapter" />
    <control name="System.Web.UI.MobileControls.BaseValidator" 
      adapter="System.Web.UI.MobileControls.Adapters.XhtmlAdapters.XhtmlValidatorAdapter" />
  </device>

  <device name="HtmlDeviceAdapters" 
    predicateClass="System.Web.UI.MobileControls.Adapters.HtmlPageAdapter" 
    predicateMethod="DeviceQualifies" 
    pageAdapter="System.Web.UI.MobileControls.Adapters.HtmlPageAdapter">
    <control name="System.Web.UI.MobileControls.Panel" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlPanelAdapter" />
    <control name="System.Web.UI.MobileControls.Form" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlFormAdapter" />
    <control name="System.Web.UI.MobileControls.TextBox" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlTextBoxAdapter" />
    <control name="System.Web.UI.MobileControls.Label" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlLabelAdapter" />
    <control name="System.Web.UI.MobileControls.LiteralText" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlLiteralTextAdapter" />
    <control name="System.Web.UI.MobileControls.Link" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlLinkAdapter" />
    <control name="System.Web.UI.MobileControls.Command" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlCommandAdapter" />
    <control name="System.Web.UI.MobileControls.PhoneCall" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlPhoneCallAdapter" />
    <control name="System.Web.UI.MobileControls.List" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlListAdapter" />
    <control name="System.Web.UI.MobileControls.SelectionList" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlSelectionListAdapter" />
    <control name="System.Web.UI.MobileControls.ObjectList" 
        adapter="System.Web.UI.MobileControls.Adapters.HtmlObjectListAdapter" />
    <control name="System.Web.UI.MobileControls.Image" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlImageAdapter" />
    <control name="System.Web.UI.MobileControls.BaseValidator" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlValidatorAdapter" />
    <control name="System.Web.UI.MobileControls.ValidationSummary" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlValidationSummaryAdapter" />
    <control name="System.Web.UI.MobileControls.Calendar" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlCalendarAdapter" />
    <control name="System.Web.UI.MobileControls.TextView" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlTextViewAdapter" />
    <control name="System.Web.UI.MobileControls.MobileControl" 
      adapter="System.Web.UI.MobileControls.Adapters.HtmlControlAdapter" />
  </device>

  <device name="UpWmlDeviceAdapters" 
    inheritsFrom="WmlDeviceAdapters" 
    predicateClass="System.Web.UI.MobileControls.Adapters.UpWmlPageAdapter" 
    predicateMethod="DeviceQualifies" 
    pageAdapter="System.Web.UI.MobileControls.Adapters.UpWmlPageAdapter">
  </device>

  <device name="WmlDeviceAdapters" 
    predicateClass="System.Web.UI.MobileControls.Adapters.WmlPageAdapter" 
    predicateMethod="DeviceQualifies"
    pageAdapter="System.Web.UI.MobileControls.Adapters.WmlPageAdapter">
    <control name="System.Web.UI.MobileControls.Panel" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlPanelAdapter" />
    <control name="System.Web.UI.MobileControls.Form" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlFormAdapter" />
    <control name="System.Web.UI.MobileControls.TextBox" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlTextBoxAdapter" />
    <control name="System.Web.UI.MobileControls.Label" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlLabelAdapter" />
    <control name="System.Web.UI.MobileControls.LiteralText" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlLiteralTextAdapter" />
    <control name="System.Web.UI.MobileControls.Link" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlLinkAdapter" />
    <control name="System.Web.UI.MobileControls.Command" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlCommandAdapter" />
    <control name="System.Web.UI.MobileControls.PhoneCall" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlPhoneCallAdapter" />
    <control name="System.Web.UI.MobileControls.List" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlListAdapter" />
    <control name="System.Web.UI.MobileControls.SelectionList" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlSelectionListAdapter" />
    <control name="System.Web.UI.MobileControls.ObjectList" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlObjectListAdapter" />
    <control name="System.Web.UI.MobileControls.Image" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlImageAdapter" />
    <control name="System.Web.UI.MobileControls.BaseValidator" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlValidatorAdapter" />
    <control name="System.Web.UI.MobileControls.ValidationSummary" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlValidationSummaryAdapter" />
    <control name="System.Web.UI.MobileControls.Calendar" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlCalendarAdapter" />
    <control name="System.Web.UI.MobileControls.TextView" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlTextViewAdapter" />
    <control name="System.Web.UI.MobileControls.MobileControl" 
      adapter="System.Web.UI.MobileControls.Adapters.WmlControlAdapter" />
  </device>

  <device name="ChtmlDeviceAdapters" 
    inheritsFrom="HtmlDeviceAdapters" 
    predicateClass="System.Web.UI.MobileControls.Adapters.ChtmlPageAdapter"
    predicateMethod="DeviceQualifies" 
    pageAdapter="System.Web.UI.MobileControls.Adapters.ChtmlPageAdapter">
    <control name="System.Web.UI.MobileControls.Form" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlFormAdapter" />
    <control name="System.Web.UI.MobileControls.Calendar" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlCalendarAdapter" />
    <control name="System.Web.UI.MobileControls.Image" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlImageAdapter" />
    <control name="System.Web.UI.MobileControls.TextBox" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlTextBoxAdapter" />
    <control name="System.Web.UI.MobileControls.SelectionList" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlSelectionListAdapter" />
    <control name="System.Web.UI.MobileControls.Command" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlCommandAdapter" />
    <control name="System.Web.UI.MobileControls.PhoneCall" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlPhoneCallAdapter" />
    <control name="System.Web.UI.MobileControls.Link" 
      adapter="System.Web.UI.MobileControls.Adapters.ChtmlLinkAdapter" />
  </device>
</mobileControls>

Example

The following example illustrates a control that inherits from the Form class, and provides the ability to raise events or perform other actions after a given timer interval.

<mobileControls>
    <device name="PortalHtmlDeviceAdapters" inheritsFrom="HtmlDeviceAdapters">
        <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.HtmlTabbedPanelAdapter,Portal" />
        <control name="ASPNetPortal.MobileControls.LinkCommand, Portal" adapter="ASPNetPortal.MobileControls.HtmlLinkCommandAdapter,Portal" />
    </device>
    <device name="PortalChtmlDeviceAdapters" inheritsFrom="ChtmlDeviceAdapters">
        <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.ChtmlTabbedPanelAdapter,Portal" />
    </device>
    <device name="PortalWmlDeviceAdapters" inheritsFrom="WmlDeviceAdapters">
        <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.WmlTabbedPanelAdapter,Portal" />
    </device>
</mobileControls>

Element Information

Configuration Section Handler

System.Web.UI.MobileControls.MobileControlsSection

Configuration Member

SystemWebSectionGroup.MobileControls

Configurable Locations

Machine.config

Root-level Web.config

Application-level Web.config

Virtual or physical directory level Web.config

Requirements

IIS 5.0, IIS 5.1, or IIS 6.0

.NET Framework 1.1, or 2.0

Visual Studio 2003, or Visual Studio 2005

See Also

Tasks

How to: Configure Specific Directories Using Location Settings

How to: Lock ASP.NET Configuration Settings

Concepts

ASP.NET Configuration File Hierarchy and Inheritance

Securing ASP.NET Configuration

ASP.NET Configuration Scenarios

Reference

system.web Element (ASP.NET Settings Schema)

configuration Element (General Settings Schema)

control Element for device for mobileControls (ASP.NET Settings Schema)

deviceFilters Element (ASP.NET Settings Schema)

MobileControlsSectionHandler

System.Configuration

System.Web.Configuration

Other Resources

Using Device Filters

ASP.NET Mobile Web Pages

Creating ASP.NET Mobile Web Pages

General Configuration Settings (ASP.NET)

ASP.NET Configuration Settings

Administering ASP.NET Web Sites

ASP.NET Configuration Files

ASP.NET Configuration API