Building a mobile Web Form
The Microsoft Mobile Internet Toolkit (MMIT), available as an
add-on to Visual Studio .NET, provides the tools to enable mobile Web
application development. MMIT makes it easy to build a single mobile Web-based
application that will automatically generate HTML, compact HTML (cHTML), or
Wireless Markup Language (WML), depending on the target device's capabilities,
and do so using business logic in XML Web services. Now with MMIT, targeting
multiple devices with a single Visual Studio .NET application is as seamless as
building a rich Windows-based desktop application.
Having added new gift certificate capabilities to its site in
the previous part, Downhill Bikes now needs an easy way for their dealers to
validate the gift certificates online. They also want an easy way for their
customers to check the balance of their gift certificates online.
In this part you will use the Mobile Web designer in Visual
Studio .NET to build a Web page that can be accessed by a variety of devices,
giving DownhillBikes’ dealers and their customers complete flexibility in
running the mobile Web application.
When MMIT is installed, Mobile Web Forms are integrated
directly into the Visual Studio .NET IDE. In this step, you will start a new
a. From the View menu,
click Solution Explorer. CTRL+ALT+L
b. In the Solution
Explorer, right-click DownhillBikes, click Add, then click Add
New Item… .
c. Click Mobile Web Form in the Templates pane, type Verify.aspx
in the Name box, and click Open.
Building mobile Web forms is identical to building Web Forms
and Windows Forms. The code behind is also the same so leveraging work done in
other projects is easy.
a. From the View menu,
click Toolbox. CTRL+ALT+X
b. Click the Mobile
Web Forms tab in the toolbox.
c. Drag a Label onto the
d. In the Properties
window, type serial number in the Text property box.
e. Drag a TextBox onto
the form below the label.
f. Drag a Command onto
the form below the TextBox.
g. In the Properties
window, type Validate in the Text property box for the Command. Your
form should look like the following:
In this step you will drag a second mobile form onto the
design surface and add a label to it. This form will be used to display the results of the validation
performed in the previous step.
a. Drag a Form onto the
design surface below the first form (Form1).
b. Drag a Label onto the
second form. Form2 should look like the one shown below:
In this step you will add code behind the validation button
added in the previous step to call the server-side validation component and
return text indicating whether or not the certificate is valid.
a. Double-click the Validate
b. In the toolbox,
double-click 6.4 Validate code.
Let’s run the application and check a certificate we got in
a. From the File
menu, click Build and Browse. CTRL+F8
b. Type the serial
number previously viewed in the box (000102506258, for example) and click Validate.
c. The certificate
should be valid.
d. Click Back,
change one of the digits, and click Validate. Making random changes
should result in an invalid certificate.
f. Close your browser.
Using the Microsoft Mobile Explorer we can emulate an actual
WAP phone to test the functionality and compatibility of our mobile page.
a. If you have the
Microsoft Mobile Explorer Browser installed, you can preview this page from a
cell phone emulator.
b. From the View
menu, click Mobile Explorer Browser, and then choose Show Browser.
c. Type https://localhost/downhillbikes/verify.aspx
in the navigation box.
d. Click the text box and type 000102506258 for the
e. Click OK, then click Validate. The resulting
screens should look similar to the following:
e. In Visual Studio
.NET, from the Window menu, click Close All Documents. If asked to save
changes, click Yes.
The Visual Studio .NET Guided Tour covered three areas:
building client application, web-based server applications, and XML Web
The Microsoft .NET platform pivots itself around these 3 fundamentals
that are driving the digital revolution. First, the platform was built in
concert with the Microsoft strategy around XML Web services – the crucial
factor in solving the pressing problem of software and business integration.
Second, Microsoft .NET provides the underlying substrate to deliver client
experiences tailored to the desktop PC, the thin-client Web browser, and to the
multitude of emerging smart devices. Finally, the Microsoft .NET platform
recognizes the need for enterprise-critical server software and integration.
Visual Studio .NET represents the cornerstone to the
Microsoft .NET platform. It is the tool that developers will use to drive their
organizations and their customers into the world of XML Web services. Like the
.NET platform itself, Visual Studio .NET aligns itself around the essentials of
his digital revolution – XML Web services, Clients, and Servers.
By providing the most efficient way to both build and consume
XML Web services, Visual Studio .NET keeps developers on the vanguard of next
generation application development. In addition, Visual Studio .NET extends the
concept of RAD to every facet of the client experience, enabling developers to
build desktop, Web, and mobile applications using the skills they already have
and the languages they already know. Finally, Visual Studio .NET demystifies
server-side development – providing RAD development of business logic,
supplying the tools needed to deploy data-rich Internet applications, and
delivering the premier suite of enterprise servers to satisfy every business
With Visual Studio .NET, the once unattainable goals of
developers and organizations alike are finally brought within reach. Empowering
organizations to seamlessly move to the world of XML Web services, delivering
resources for every client experience, and addressing the issues of server
development and integration – Visual Studio .NET unleashes the power of .NET.
The final part to the Guided Tour provided an
introduction to the Microsoft Mobile Internet Toolkit (MMIT). MMIT provided a forms-based visual interface
to build mobile applications for a variety of emerging smart mobile devices.