ASP.NET Mobile Controls Overview
Writing dynamic, high-performance mobile Web applications has never been easier.
Over the past few years, the world has seen an explosion of new wireless
devices, such as cell phones, pagers, and personal digital assistants (PDAs),
which enable users to browse Web sites at any time from any location.
Developing applications for these devices is challenging for the following
reasons:
- Different markup languages are necessary, including HTML for PDAs, wireless
markup language (WML) for wireless application protocol (WAP) cell phones, and
compact HTML (cHTML) for Japanese i-mode phones.
- Devices have different form factors. For example, devices have varying numbers
of display lines, horizontal or vertical screen orientation, and color or black
and white displays.
- Devices have different network connectivity, ranging from 9.6 KB cellular
connections to 11 MB Wireless LANs.
- Devices have different capabilities. Some devices can display images, some can
make phone calls, and some can receive notification messages.
The Microsoft Mobile Internet Toolkit addresses these challenges by
isolating them from the details of wireless development. Thus, developers can
quickly and easily build a single, mobile Web application that delivers
appropriate markup for a wide variety of mobile devices.
Figure 1. The Hello, World program renders to both a cell phone and a Pocket PC
The Mobile Internet Toolkit contains:
- Mobile Web Forms Controls that generate markup language for different devices.
- Mobile Internet Designer that works with the Visual Studio .NET integrated design environment (IDE) to
provide a drag-and-drop mobile development environment.
- Browser Capabilities that are rich enough to extend ASP.NET device capabilities to mobile devices.
- QuickStart Tutorial with sample code.
- Developer Documentation.
- Device adapter code samples.
Mobile Web Forms Controls
The mobile Web Forms controls are ASP.NET
server-side controls that provide user interface elements such as
list, command, call, calendar, and so on. At execution time, the
mobile controls generate the correct markup for the device that
makes the request. As a result, you can write a mobile application
once and access it from multiple devices.
Because these mobile controls are based on the ASP.NET controls, you can
leverage your current desktop development skill set when creating mobile
applications. You can also reuse the same business logic and data access code
that you use in your desktop application. Mobile and desktop Web Forms can
reside in the same Visual Studio .NET project. This makes an application faster
to develop and lowers your maintenance cost.
The following example provides just a taste of programming with mobile controls.
In this example, the Hello, World program creates a mobile Web Forms page with
a single form on it. That form contains a Label control with the string:
“Hello, Mobile World”.
<%@ Page language="C#" Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<mobile:Form id=Form1 runat="server">
<mobile:Label id=Test Runat="Server">Hello, Mobile World</mobile:Label>
</mobile:Form>
In Figure 1 above, you can see how this code renders on different devices. The
first device is a cell phone running a WAP browser that supports WML. The
second device is Pocket PC running an HTML browser.
The Mobile Internet Toolkit also enables you to customize the markup that is
generated by mobile controls for a specific device. You can designate templates
and styles for a specific device within the mobile page.
Mobile Internet Designer
The Mobile Internet Designer extends the Visual Studio .NET IDE to create mobile
applications. After you install the Mobile Internet Designer, you can create
and develop your mobile application in the same way that you would develop a
Windows Forms or Web Forms application. The Mobile Internet Designer leverages
the traditional Visual Studio design environment so that you can:
- Create a mobile Web project.
- Add a mobile Web Forms page to the project.
- Drag a mobile Web Forms control onto the form.
- Double-click the control to write the logic.
- Rebuild the application.
- Run the application.
The Mobile Internet Designer makes it fast and easy to build and maintain mobile
Web applications. In addition, it enables today's desktop developers to quickly
learn how to create mobile applications by using Visual Studio .NET.
The following illustration shows a mobile application developed in Visual Studio
.NET with the Mobile Internet Designer.

Figure 2. Device Capability Mechanism
Accurate information about the display capabilities of the target device is
essential for the successful rendering of mobile controls. At a minimum, mobile
controls need the following information about a device:
- Markup language (HTML, WML, cHTML)
- Browser
- Number of display lines
- Cookie support
- Screen size
The Mobile Internet Toolkit adds these mobile device capabilities to the
server's machine.config file (desktop ASP.NET applications use this file to
maintain device and browser information).
Advanced Features: Extensibility
In addition to adding device characteristics,
the Mobile Internet Toolkit includes device adapters for a variety
of mobile devices. The device capabilities information in the
machine.config file allows device adapters to optimize markup for
specific devices. You can create new aggregate controls from
existing mobile controls. The Mobile Internet Toolkit supports
device adapters for additional devices through the device
capabilities mechanism.
Conclusion
The Mobile Internet Toolkit provides the
technology and tools to build, deploy, and maintain sophisticated
mobile applications quickly. Tight integration with Visual Studio
.NET ensures that developers can leverage their existing desktop
skill set and produce mobile applications. Additional device support
can be added using the Mobile Internet Toolkit's extensibility
features.