DeviceSpecificChoice Class
Note: This API is now obsolete.
Provides a single choice within a DeviceSpecific/Choice construct. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.
Assembly: System.Web.Mobile (in System.Web.Mobile.dll)
[PersistNameAttribute(L"Choice")] [ObsoleteAttribute(L"The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")] [AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class DeviceSpecificChoice : IParserAccessor, IAttributeAccessor
The DeviceSpecificChoice type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DeviceSpecificChoice | Initializes a new instance of the DeviceSpecificChoice class. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
| Name | Description | |
|---|---|---|
![]() | Argument | Gets or sets the argument used for a Filter property. The default value is nullptr. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | Contents | Gets the overridden properties defined for a choice in a DeviceSpecific/Choice construct. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | Filter | Gets or sets the name of a device filter. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | HasTemplates | Gets a value indicating whether the currently selected choice in the <DeviceSpecific> element has templates defined within it. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | Templates | Gets the templates that have been defined in the <Choice> element. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | Xmlns | Gets or sets the type of markup in a <Choice> element. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
| Name | Description | |
|---|---|---|
![]() | AddParsedSubObject | Adds the Object to the DeviceSpecificChoice object's Templates object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAttribute | Returns the specified attribute from the DeviceSpecificChoice object. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | SetAttribute | Assigns the given value to the attribute specified by the key. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IAttributeAccessor::GetAttribute | Infrastructure. For a description of this member, see IAttributeAccessor::GetAttribute. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() ![]() | IAttributeAccessor::SetAttribute | Infrastructure. For a description of this member, see IAttributeAccessor::SetAttribute. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
![]() ![]() | IParserAccessor::AddParsedSubObject | Infrastructure. For a description of this member, see IParserAccessor::AddParsedSubObject. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. |
This class is analogous to the <Choice> element. Choices are tested in the order that they appear within a <DeviceSpecific> element. If you specify the Filter property of the <Choice> element, its value must be the name of a device filter defined in the <deviceFilters> section of the Machine.config file. At run time, ASP.NET evaluates the specified device filter against the capabilities of the current device. If successful, the choice is selected. If you do not specify the Filter property, the defaults for the <Choice> element are selected.
The following code example shows a <Choice> element within an image. The Source attribute overrides the ImageUrl property of the Image control.
Although the example uses functions to determine whether the browser requires WML (isWML11) or supports color (supportsColor), you can instead use a Web.config file to define a <DeviceSpecific> element that the .NET Framework automatically uses to make the determination for you.
<deviceFilters>
<filter name="isWML11"
compare="PreferredRenderingType"
argument="wml11" />
<filter name="supportsColor"
compare="IsColor"
argument="true" />
</deviceFilters>
Note |
|---|
The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Page Syntax Overview. |
- AspNetHostingPermission
For operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission
For operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.





Note