HOW TO: Use Device Specific Property Values on Mobile Web Forms Pages (314529)



The information in this article applies to:

  • Microsoft Mobile Internet Toolkit (MMIT)

This article was previously published under Q314529

SUMMARY

This step-by-step article describes how to override the property values of mobile Web Forms controls for specific devices.

back to the top

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
  • Microsoft Visual Studio .NET
  • Microsoft .NET Framework
  • .NET Framework SDK
  • The Microsoft Mobile Internet Toolkit (MMIT) with the Mobile Internet Designer
back to the top

Introduction

The MMIT enables information technology professionals to deploy Web sites for both desktop computers and wireless mobile devices. These devices can range from Web phones to handheld personal computers. The MMIT provides a set of mobile server controls that you can use in your Web pages. The mobile controls, also called mobile Web Forms controls, detect the type of device that is used to browse the application, and then emit markup language that is appropriate for the device. For example, if you browse with a WML (Wireless Markup Language) device, the mobile controls emit WML to your device.

Because mobile devices have a wide variety of display capabilities, you may need to customize the output of your Web pages for specific devices. To do this, you can override the values of mobile controls based on the type of device that is used to browse the application.

Overriding the property values of mobile Web Forms controls for specific devices is a two-step process. First, you must assign one or more device filters to the control. Next, you must associate the device specific property values with the device filter.

back to the top

Create Device Filters

  1. Select the control to which you want to apply the filter.
  2. In the Properties dialog box, click the ellipsis button (...) for the AppliedDeviceFilters property. The Applied Device Filters dialog box appears.
  3. Click Edit to create or modify filters. The Device Filter Editor dialog box appears.
  4. Click New Device Filter.
  5. Type the name for your new filter. Note that filter names are case sensitive.
  6. Select a filter type (such as Equality Comparison), and then fill in the Compare and Argument fields.

    NOTE: The Compare and Arguments fields use the mobileCapabilities class to return True or False.
  7. Use the arrow buttons to define the order in which you want the device filters to be saved in the application configuration file (Web.config).
  8. Click OK to save the device filters in the application configuration file, and then close the Device Filter Editor dialog box.
back to the top

Apply Device Filters

  1. Select the control to which you want to apply the filter.
  2. In the Properties dialog box, click the ellipsis button (...) for the AppliedDeviceFilters property. The Mobile Internet Designer displays the Applied Device Filters dialog box.
  3. The Available Device Filters list contains all of the device filters that are defined at the application level. Select a device filter that you want to use, or type the name of an evaluator-delegate method that is defined in the code-behind file of the mobile Web Forms page.
  4. Click Add To List. The selected device filter or method name is added to the Applied Device Filters list.
  5. Click the new device filter in the Applied Device Filters list.
  6. In the Argument box, type the optional device filter argument. For comparison filters, the argument replaces the value that is defined in the Device Filter Editor dialog box and is saved in the Web.config file. For delegate-based filters, the argument is passed to the method. If no argument is specified, a null value is used.
  7. Use the arrow buttons to order the applied device filters. At run time, the application tests the filters in succession from the top to the bottom. The first device filter that results in a successful evaluation determines which set of values the application uses.
  8. Click OK to close the Applied Device Filters dialog box.
back to the top

Override Property Values

  1. Select the control whose property values you want to override for specific types of devices.
  2. In the Properties dialog box for the control, click the ellipsis button (...) for the PropertyOverrides property. The Property Overrides dialog box appears.
  3. In the Applied Device Filters list, select the applied device filter for which you want to define property override values.
  4. In the Device-Specific Properties list, define the property values that are associated with the selected applied device filter.
back to the top

Modification Type:MinorLast Reviewed:4/24/2003
Keywords:kbCHTMLDevice kbDeviceSpecific kbhowto kbHOWTOmaster kbHTMLDevice kbServerControls KB314529 kbAudDeveloper