Building Mobile Web Applications with .NET Mobile Web SDK & ASP.NET
by Srinivasa Sivakumar.S
A Simple Example
Let’s write a simple application that displays a text box to accept your name and displays the entered name in the next form.
<%@ Page Inherits="System.Mobile.UI.MobilePage" %>
<%@ Register TagPrefix="mobile" Namespace="System.Mobile.UI" %>
In the above code, we built two mobile forms. The first form has the id of frm1 and the next form has the id as frm2. By the way,
the Mobile Form control doesn’t support the name attribute. Instead, it supports the id attribute. That’s how the ASP.NET runtime identifies the forms.
In the first form, we’ve added a label control, text box control and a command button control. When the command button is clicked,
the server-side VB sub routine (Btn_OnClick) will be called. Those who are familiar with VB will feel right at home now. In the event handling VB
sub routine, we’re moving to the next form by setting the ActiveForm method to frm2. Then we’re accessing the label control defined in the
frm2 and setting the value submitted by the user.
Here is the screen shot of the above code in action simulated in the Phone.com and Pocket IE simulators.
Here is the view of the code generated for the Phone.com simulator by ASP.NET.
As you can see, ASP.NET generated the WML code necessary to handle the text input from the user and post it to the server.
It also generated the WML output to display the user-entered name in the next WML card.
Next: Pros And Cons