What Are Mobile Web Forms?

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Bonus Day 23.  Creating Mobile Web Forms


Imagine that you're a stock day trader. Because of the quick-paced economy, you must keep track of the markets at all times: when you're away from your computer, waiting to pick up your kids at school, cooking dinner, or even when going to the bathroom! You never know when a grand opportunity to buy the next big thing will come along. But as anyone who's dealt with the stock market knows, to play in the market, you need data: prices for stocks, company news, and other financial information.

You can get all this information, displayed as you want it, from your computer. If you're away from your keyboard, though, things start to get problematic. Stock prices are difficult to get on small devices such as cell phones, and you can forget about receiving charts and historical data. Those small, typically monochromatic screens can't hold very much data at once, and don't lend themselves well to interesting presentations. Executing a buy or sell is also difficult (unless you use the phone to call your broker, but that's a different story we're talking Web here).

Mobile Web forms are ASP.NET's answer to this problem. Their programming model is nearly identical to that of ASP.NET pages; similar syntax is used, and they even have an .aspx file extension. Their power comes from the fact that mobile Web forms use specialized server controls that are designed especially for use with mobile devices. These controls produce rich displays on any mobile device, and automatically adapt themselves to the type of device used. Thus, you can build one version of a page and everything from Nokia cell phones to Pocket PCs can access and utilize your application. In fact, mobile Web forms work even in normal browsers, just as ASP.NET pages.

Prior to ASP.NET and mobile Web forms, programming mobile Web applications was difficult. Wireless devices, unfortunately, don't provide a common set of features or capabilities for developers to rely on. Thus, each application had to be rewritten for each new device that would access it (for instance, a cell phone would require different code than a PDA). The mobile Web forms framework does away with this difficulty by automatically adjusting the pages for each particular device. I'll get into this in much more depth later today; first, let's examine mobile Web forms a bit more.

How Are Mobile Web Forms Different from ASP.NET Web Forms?

If mobile Web forms work in browsers as well, and they function similarly to ASP.NET pages, why do we need ASP.NET Web forms? Why can't we just use mobile forms all the time?

Because mobile forms are designed specifically for mobile devices, they function slightly differently from normal Web forms. An ASP.NET Label control and a mobile Label control both produce text to display on the browser, but their internal mechanics are different. For example, an ASP.NET label need concern itself only with rendering HTML to the browser; it doesn't care how much text is rendered or how it is rendered. A mobile label, however, needs to take into account the small screen size of mobile devices, and provide the proper paging mechanisms if the text to be displayed is very long. Also, a mobile label spits out different content depending on what type of device is used: HTML for browsers and WML (Wireless Modeling Language) for most cell phones (more on that in the next section).

Also, taking into account the various types of displays on mobile devices, mobile controls typically do not provide as much rendering control or style capabilities as ASP.NET server controls. Thus, they are not as appropriate for display in desktop browsers.

Throughout today's lesson, you'll see more examples of how mobile forms differ from ASP.NET Web forms. You'll also learn the many similarities between the two. All your ASP.NET skills still apply when working with mobile devices, so you're already ahead of the game!

What Do I Need to Use Mobile Web Forms?

Thankfully, you don't need a mobile device or phone service to work with mobile forms. They are completely compatible with your normal Web browser, so as long as you have that, you are all set.

However, if you do not have a mobile device but prefer working in that type of environment, there are quite a few simulators available that work with your PC, such as Microsoft's Mobile Explorer. The UP.SDK simulation package from http://developer.phone.com is another very popular simulation toolkit that is often used by Microsoft developers. Each of these simulators works differently, so I won't cover them here. All examples in today's lesson are shown using a normal Web browser.

Specifically, you'll need the same things required to develop ASP.NET pages: Windows 2000 or XP with IIS, the .NET Framework SDK, and additionally, the Microsoft Mobile Internet Toolkit (MMIT) (more in the next section). Any device you have that supports the WML or HTML is capable of displaying mobile forms, although some devices might differ in presentation (just as some Web browsers present things differently). WML is a markup language similar to HTML that is designed to specify user interfaces on wireless phones. HTML, obviously, is a markup language used to present UIs in a Web browser.

Caution

Because the .NET Framework SDK and the Mobile Web SDK are two different products that ship separately, make sure that you are using compatible versions! An older version of the MMIT might not work correctly with newer versions of the .NET Framework SDK.



    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net