Subscribe

RSS Feed (xml)

Customizing Output for a Device

The web.config file is as follows:


<deviceFilters>


<filter name="isHTML32" compare="PreferredRenderingType" argument="html32" />


<filter name="isWML11" compare="PreferredRenderingType" argument="wml11" />


</deviceFilters>


The ASPX page is as follows:


<mobile:Form id="Form1" runat="server">


<DeviceSpecific>


<Choice Filter="isHTML32">


<HeaderTemplate>


Header visible only in HTML Browsers


<BR>


<img Src="poweredbyaspnet.gif" border="0">


<HR>


</HeaderTemplate>


<FooterTemplate>


<HR>


Footer visible only in HTML Browsers


</FooterTemplate>


</Choice>


<Choice>


<mobile:Label id="Lable1" runat="server" >Powered by


ASP.NET Visible on non-HTML browsers</mobile:Label>


</Choice>


</DeviceSpecific>


<mobile:Label id="Label1" runat="server">Content of Mobile


Form visible in all devices</mobile:Label>


</mobile:Form>


Comments


It want is possible to provide a richer user experience by optimizing the output of a specific


device.You can do this by configuring device filters in your application's web.config


file. Using the results of that filter test, you can enable content to be rendered on a


device-specific basis. As shown in the previous web.config file, the first device filter provides


HTML 3.2 support and the second provides WML 1.1 support.


All mobile controls support the capability to use a DeviceSpecific/Choice filter to


customize the output.The


mobile:Form control (which is a templated control) supports


header and footer templates as well. Combining these two features in the previous example


allows you to include a header and footer on browsers that support HTML.The


device that passes the isHTML32 test will be sent HTML content, and all other devices


are sent the content in the default <Choice> filter.

No comments:

Archives

Variety in the Web World