Proceed to WirelessDevNet Home Page
Publications, e-books, and more! Community Tutorials Store Downloads, tools, & Freebies! IT Career Center News Home

EMail Address:

  - Articles
  - Columns
  - Training
  - Library
  - Glossary
   Career Center
  - Career Center Home
  - View Jobs
  - Post A Job
  - Resumes/CVs
  - Resource Center
  - Marketplace Home
  - Software Products
  - Wireless Market Data
  - Technical Books
  - Daily News
  - Submit News
  - Events Calendar
  - Unsubscribe
  - Delivery Options
  - Discussion Boards
  - Mailing List
  - Mailing List Archives
   About Us
  - About WirelessDevNet
  - Wireless Source Disks
  - Partners
  - About MindSites Group
  - Advertising Information
* Introduction
* Intro To .NET
* Mobile Controls
* Mobile Design Concepts
* A Simple Example
* Pros and Cons

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" %> <Script language="VB" runat="server"> Sub Btn_OnClick(Src As Object, E As EventArgs) ‘Move to the next mobile form ActiveForm = frm2 ‘redisplay the name. EnteredName.Text = "Your name is: " &amp; YourName.Text End Sub </Script> <mobile:Form id="frm1" runat=server> <mobile:Label runat=server>Your Name:</mobile:Label> <mobile:TextBox runat="server" id="YourName" /> <mobile:Command runat="server" id="btn" OnClick="Btn_OnClick">Ok&lt;/mobile:Command> </mobile:Form> <mobile:Form id="frm2" runat=server> <mobile:Label runat="server" id="EnteredName" /> </mobile:Form>

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 and Pocket IE simulators.

Here is the view of the code generated for the 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



Eliminate irrelevant hits with our industry-specific search engine!

Wireless Developer Network - A MindSites Group Trade Community
Copyright© 2000-2010 MindSites Group / Privacy Policy
Send Comments to: