November 22, 2014
Hot Topics:

From Mobiles to Microwaves with the Mobile Internet Toolkit

  • August 21, 2003
  • By Karl Moore
  • Send Email »
  • More Articles »

For a long, long time, Microsoft has been touting this dream of information on any device, anywhere, anytime. But, at least when it comes to Visual Basic developers, the company hasn't done much to prove it. That is, until now.

Coinciding with the first release of Visual Studio .NET, Microsoft unveiled the Mobile Internet Toolkit, a neat Visual Studio .NET-integrated extension to the .NET Framework. MIT is a program that allows you to write your own Web applications that can be displayed on almost anything—from mobile phones to microwaves, Internet Explorer to handheld PDAs. Develop once, and run anywhere.

How does it work? Well, after installing the MIT, you get to create a new type of project, a Mobile Web application. Here you can design your minimalist application. It can do anything that your regular ASP.NET applications can, but, due to the limitations of some of the devices that may use your application, you're best keeping the actual graphical side to a minimum. Next, you make your application available as you would a regular ASP.NET Web app.



Click here for larger image

Figure: Creating a new ASP.NET Mobile Web application

When your application gets requested over the Net—through whatever device—the MIT steps in and figures out exactly what sort of machine is asking to view your pages. It then configures the output appropriately (that is, a certain dropdown box-style control will look like a regular dropdown on some devices, whereas on others it will render as a clickable list), and then sends your page down the wire in the language spoken by the device—HTML, cHTML (Compact HTML), or WML (Wireless Markup Language).

In short, the MIT allows you to create intelligent, mini "Web pages" that can be viewed on practically any device. You design once and let the MIT handle all that sticky "plumbing" you really don't want to get involved in.

TOP TIP Microsoft is slowly renaming the Mobile Internet Toolkit to ASP.NET Mobile Controls. It is, however, being awfully inconsistent about the process. Many parts of the Microsoft site use the terms interchangeably. Just keep in mind that the two terms refer to the same thing. During the rest of this section, I'm going to stick with Mobile Internet Toolkit.

Creating Your Mobile Web Application

How do you go about creating your own mobile applications? First off, you'll need to access the MIT. If you're using Visual Studio .NET 2003 (Everett), it's actually built into Visual Studio. If you aren't, however, or you want to access the latest device updates, you'll need to surf down to msdn.microsoft.com/vstudio/device/mitdefault.asp. The main MIT setup is a cool 4MB download. Just follow the simple installation wizard to get started.

Next, launch Visual Studio .NET and create a new ASP.NET Mobile Web Application project (or quite simply a Mobile Web application, if you aren't using Visual Studio .NET 2003). You'll be shown MobileWebForm1.aspx. On the page, you have a small Form1 object. This represents a "page" on your device. Because most mobile pages will be relatively small, Microsoft decided to allow you to create a bundle on just one page (along with, naturally, a code method of switching between them). The first form on the page is the first to be displayed when the page is accessed.

You can either simply start typing in this Form control, or add controls, by dragging and dropping from the Mobile Web Forms tab in the toolbox. You'll be able to instantly figure out most of these from their icons: the Label, the TextBox (with its useful Numeric property for number-only input), the multi-line TextView, the Command button, the Link, the SelectionList, the Image control, the excellently rendered Calendar control, and the validation controls. You can add code to respond to most of these items just as you would a regular ASP.NET Web application.



Click here for larger image

Figure: Designing our Mobile Web application

Other controls aren't quite so obvious however. The DeviceSpecific component allows you to target content at devices bearing particular properties, for example. One real favorite, however, is the PhoneCall control. Set its Text and PhoneNumber properties, and, on supporting phones, it'll turn into a link that allows your user to directly call that number. By default, if a device doesn't support dialing (Internet Explorer, for example), it'll display the Text and PhoneNumber properties alongside each other instead ("{0} {1}", the AlternateFormat default). Another way of handling this could be to put your own text in the AlternateFormat property and specify a link for the AlternateUrl.

So, you've added a few neat controls to your first form. Next, you begin coding in practically the same way as you would an ASP.NET Web application. Respond to Click events, change properties, add code to respond to the form Activate event (the Web page Load equivalent).





Page 1 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel