C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




The secret of ASP.NET 2.0 mobile pages


Posted Date: 08 Jul 2006    Resource Type: Articles    Category: Web Applications
Author: Balamurali BalajiMember Level: Diamond    
Rating: Points: 10



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.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Confirm Delete Box in DataGrid Delete Button
Previous Resource: ASP.NET Viewstate
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use