Introduction
You all are familiar with ASP.NET 1.1 version of mobile development. You have a set of , like many standard controls. These mobile controls give you a look and feel of the standard controls you use with , server controls. These pages can be viewed on the web browser or mobile device or emulator as the controls are delivered in required format accordingly. The formats include WML, HTML, CHTML(Compact HTML used by i-mode devices in Japan).
So, what is new in ASP.NET 2.0?
Instead of rendering the content of a mobile page individually, the controls uses a set of adapter classed that are assigned to them. Each controls would have a corresponding Adapter class and one Adapter could serve more than one control. These adapters are configured within the ASP.NET and are included for all the standard controls. This new concept is called "Adaptive Rendering". Remember the Adapter pattern, and the article I wrote on it.
So, what is the advantage?
Since there is an isolation between the control and adapter, inclusion of new or individual target devices has become an easier task. You can modify even the output of a control to server different purposes still not changing the control itself. By default, you could see this difference when you run the same mobile page in different devices or emulators.
Even though the single User Interface is not suffient enough to cater to all the devices, you can still use the same controls and programming model you are already familiar with.
The following example page could be viewed on your regula desktop IE, IE for Pocket PCs, and the openWave WAP emulator. You can try on other emulators from nokia, samsung also.
<%@ page language="C#" %>
<script runat="server">
void b1_click(object sender, System.EventArgs e) { this.l1.Text = "Your name is " + this.t1.Text; }
>/script>
html> <head runat="server"> <title>My Mobile Page</title> </head> <body> <form runat="server"> <p>Please enter your name:<br> <asp:textbox id="t1" runat="server" /> <asp:button id="b1" runat="server" text="OK" onClick="b1_click" /> </p> <asp:literal id="l1" runat="server"/> </form> </body> </html> </p>
So, what else the Adaptive Rendering offers?
New controls in ASP.NET 2.0 provides you a capability called Device Filter. It is used to assign special properties in a declarative way for different devices. Once you configure your application and device, you can just specify a device filter for almost all the controls, all the properties and attributes or even for the entrie page.
For this, you need to assign a unique ID of the device in front of the parameter name of the properties. Look at the sample code here:
<asp:Image imageurl="clouds.jpg" netscape:imageurl="waterlilly.jpg" />
One image control displaying different images depending on the browser.
Besides the "Device Filter" feature, you have an option of configuring your application for different browsers. The Browser Configuration file is just simliar to web.config file stored in a separte sub folder in your windows system folder. These files will have an extension of .browser.
So, what is the conclusion?
ASP.NET 2.0 offers you the flexibility and ease of use when it comes to mobile development. With a simple architectural changes, you can make use of your existing ASP.NET skills to develop mobile pages.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|