Answers for Day 23

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Appendix A.  Answers to Quiz Questions


Quiz

1:

What are the two headers required for every mobile page?

A1:

The standard header is as follows:

 <%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="VB" %> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" %> 
2:

True or false: Mobile server controls don't require the runat="server" attribute.

A1:

False. Mobile server controls are still server controls, and therefore are required to be created on the server.

3:

What does the Call server control do?

A1:

It presents UI to enable the user to dial a phone number.

4:

What are the two values for the StyleReference property?

A1:

Title, which causes text to be displayed in bold, and Error, which causes text to be rendered in italicized red.

5:

How do you explicitly display a mobile Web form programmatically?

A1:

Set the ActiveForm property to the form's name.

6:

True or false: You can respond to mobile server control events the same as ASP.NET server control events.

A1:

True.

7:

What does the <DeviceSelect> element do, and what does it represent on the page?

A1:

The <DeviceSelect> provides a means to display different content depending on the viewing device. It is used as a container on the page for <Choice> elements.

Exercise

Q1:

Create a mobile application that will allow users to make credit card payments through their cell phones. Users should be allowed to enter a credit card number and a value for the amount to be paid (don't forget to supply a way to submit the input). Don't worry about recording or applying the payment to something. Simply display a thank-you message to the user when the submission is complete.

A1:

The code for the exercise is as follows:

 1:  <%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="VB" %> 2:  <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.Mobile.Controls" %> 3: 4:  <script runat="server"> 5:     sub PayBill(Sender as Object, e as EventArgs) 6:        lblMessage.Text = "Thank you for using the " & _ 7:           "Mobile Payment service. The details of " & _ 8:           "your transaction are:" 9:        lblNumber.Text = tbNumber.Text 10:        lblAmount.Text = tbAmount.Text 11: 12:        ActiveForm = frmThanks 13:     end sub 14:  </script> 15: 16:  <Mobile:Form runat="server"> 17:     <Mobile:Label runat="server" StyleReference="title" 18:        Text="Pay Bill" /> 19:     <Mobile:Label runat="server" Text="CC #" /> 20:     <Mobile:TextBox runat="server"  21:        Type="Numeric" /> 22:     <Mobile:Label runat="server" Text="Amount $" /> 23:     <Mobile:TextBox runat="server"  24:        Type="Numeric" /> 25:     <Mobile:Command runat="server"  26:        OnClick="PayBill" 27:        Text="Pay Bill!" /> 28:  </Mobile:Form> 29: 30:  <Mobile:Form runat="server" > 31:     <Mobile:Label runat="server"  /> 32:     <Mobile:Label runat="server"  /> 33:     <Mobile:Label runat="server"  /> 34:  </Mobile:Form> 


    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