mobileControls 的 device 項目 (ASP.NET 設定結構描述)
更新:2007 年 11 月
定義新的配接器集,此配接器集會將 ASP.NET Mobile 控制項對應至 Web.config 組態檔之 system.web 項目 (ASP.NET 設定結構描述) 和 <mobileControls> 區段中的相符配接器。
configuration 項目 (一般設定結構描述)
system.web 項目 (ASP.NET 設定結構描述)
mobileControls 項目 (ASP.NET 設定結構描述)
mobileControls 的 device 項目 (ASP.NET 設定結構描述)
<device name="String" inheritsFrom="String" " pageAdapter="String" predicateClass="String" predicateMethod="String> <control.../> </device>
屬性和項目
下列章節會說明屬性 (Attribute)、子項目和父項目。
屬性
屬性 |
描述 |
---|---|
name |
必要 String 屬性 指定必須用以辨識裝置配接器集的唯一名稱。 |
inheritsFrom |
選擇性的 String 屬性。 指定這個集合必須繼承的裝置配接器集。指定的裝置配置器集合可以稍早出現在相同 <mobileControls> 區段中,或出現在較高層級組態檔的 <mobileControls> 區段中。 |
pageAdapter |
選擇性 String 屬性。 指定配接器集之頁面配接器的類別型別。指定的類別必須實作 IPageAdapter 介面。名稱必須遵循 .NET Framework 標準對指定完整型別名稱的規定。 ASP.NET 會搜尋該型別的指定組件。如果配接器集是繼承自其他的配接器集,就不需要 pageAdapter 屬性,也將預設成為父集的值。 |
predicateClass |
選擇性 String 屬性。 指定可提供評估工具述詞 (Predicate) 的類別型別。您用在類別型別的名稱必須遵循 .NET Framework 標準對指定完整型別名稱的規定。 ASP.NET 會搜尋該型別的指定組件。如果配置器集合是從另一個型別繼承,就不需要 predicateClass 屬性,也將預設成為父集的值。 |
predicateMethod |
選擇性 String 屬性。 指定可提供評估工具述詞的方法。這個方法必須是靜態的,並屬於以下簽章:
如果配接器集是繼承自其他的配接器集,就不需要 predicateMethod 屬性,也將預設成為父集的值。 |
子項目
項目 |
說明 |
---|---|
control |
將 ASP.NET Mobile 控制項對應至特定的裝置配接器。 |
父項目
項目 |
描述 |
---|---|
configuration |
Common Language Runtime 和 .NET Framework 應用程式所使用之每個組態檔中的必要根項目。 |
system.web |
針對組態檔中的 ASP.NET 組態設定指定根項目。包含設定 ASP.NET Web 應用程式和控制該應用程式之行為方式的項目。 |
mobileControls |
定義能將 ASP.NET Mobile 控制項對應至 Web.config 檔 system.web 項目 (ASP.NET 設定結構描述) 區段中之對應配置器的配置器集合。 |
備註
如果 <device> 區段包括 inheritsFrom 屬性,則您不需要宣告 predicateClass、predicateMethod 或 pageAdapter 屬性。而是,您的裝置配接器集可從父裝置配接器集定義繼承這些屬性。
注意事項: |
---|
雖然這些屬性不是必需的,但是如果您的應用程式合用,也可以定義這些屬性。 |
您可在配接器集內放置任何數目的控制區段或項目,每個控制區段或項目都提供特定的控制項配接器對應 (實作 IControlAdapter 的類別)。
預設的組態
下列預設 <mobileControls> 項目是在 .NET Framework 2.0 版中的根 Web.config 檔中設定。
<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>
範例
下列範例將說明繼承自 Form 類別的控制項,並提供在指定的時間間隔後,引發事件或執行其他動作的能力。
<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>
項目資訊
Configuration Section Handler |
|
Configuration Member |
|
Configurable Locations |
Machine.config 根層次 Web.config 應用程式層級 Web.config 虛擬或實體目錄層級 Web.config |
Requirements |
IIS 5.0、IIS 5.1 或 IIS 6.0 .NET Framework 1.1 或 2.0 Visual Studio 2003 或 Visual Studio 2005 |
請參閱
工作
概念
參考
system.web 項目 (ASP.NET 設定結構描述)
mobileControls 之 device 的 control 項目 (ASP.NET 設定結構描述)
deviceFilters 項目 (ASP.NET 設定結構描述)