Share via


DeviceSpecificChoice Class

Provides a single choice within a DeviceSpecific/Choice construct.

public class System.Web.UI.MobileControls.DeviceSpecificChoice : 
   System.Object, System.Web.UI.IParserAccessor,
   System.Web.UI.IAttributeAccessor

Remarks

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 Device 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, the 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 Device property, the defaults for the <Choice> element are selected.

Example

This code example shows a <Choice> element within an image. The Source attribute overrides the ImageURL property of the Image control.

<mobile:Image runat="server" AlternateText="Cannot display this image.">
    <DeviceSpecific>
        <choice Filter="Color" ImageURL="colorImage.gif"/>
        <choice Filter ="Wml" ImageURL="wmlImage.wbmp"/>
        <choice ImageURL="monoImg.gif"/>
    </DeviceSpecific>
</mobile:Image>

Requirements

Namespace: System.Mobile.Web.UI.MobileControls

Assembly: System.Web.Mobile

See Also

DeviceSpecific Class | Adapter Mappings