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

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

<control name="String"
         adapter="String" />

Attributes and Elements

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

Attributes

Attribute Description

adapter

Required String attribute.

The fully qualified name of the device adapter.

name

Required String attribute.

The fully qualified name of the control.

Child Elements

None.

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.

device

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

Remarks

Although there is a one-to-one mapping between control and adapter, it is not necessary to write a unique control adapter class for every control/device combination. In general, if a new mobile control uses inheritance or simple composition, and does not require customized output, it does not require a control adapter. For more information, see Adapter Mappings.

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

System.Web.Configuration.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

Reference

system.web Element (ASP.NET Settings Schema)
configuration Element (General Settings Schema)
device Element for mobileControls (ASP.NET Settings Schema)
deviceFilters Element (ASP.NET Settings Schema)
MobileControlsSectionHandler
System.Configuration
System.Web.Configuration

Concepts

ASP.NET Configuration File Hierarchy and Inheritance
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios

Other Resources

Using Device Filters
ASP.NET Mobile Web Pages
Creating ASP.NET Mobile Web Applications
General Configuration Settings (ASP.NET)
ASP.NET Configuration Settings
Configuring ASP.NET Applications
ASP.NET Configuration Files
ASP.NET Configuration API