There can be only one default Choice element within a
DeviceSpecific element. Because the filter mechanism stops searching at the first match, it
is recommended that you put the default Choice element last.
Filter Attribute and deviceFilters Configuration
At this point, you may be wondering how device detection is linked to the DeviceSpecific/
Choice element with its filter attribute in the mobile control. The filter attribute refers to a
set of XML elements added to the standard web.config file when you select an ASP.NET mobile
web application in Visual Studio .NET. You can also manually add these elements to an existing
web.config file. The additional configuration section in web.config is appropriately named
deviceFilters, as shown in the web.config for the ControlsBook2Mobile project.
The filter XML element represents the comparison rules that controls link to for making
their rendering choices. Each filter element has three main properties:
??? name
??? compare
??? argument
CHAPTER 10 ?– OTHER S ERVER C ONTROLS 495
Name is used to uniquely identify the filter and is what the Choice element within a
mobile control is matched against. The compare attribute is the name of the property of the
MobileCapabilities object to test.
Pages:
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644