移动设备 |
Internet网络 |
IIS服务 |
.NET框架 |
ASP.NET |
移动.NET |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Dim age Sub AgeClick(sender As Object, e As EventArgs) age=text1.Text ActiveForm=Form2 End Sub Sub Form2_Activate(sender As Object,e As EventArgs) message.Text="You are " & age & " years old" End Sub </script> <Mobile:Form id="form1" runat="server"> <Mobile:Label runat="server">Age?</Mobile:Label> <Mobile:TextBox runat="server" id="text1" /> <Mobile:Command runat="server" OnClick="AgeClick" Text="Submit" /> </Mobile:Form> <Mobile:Form id="form2" runat="server" OnActivate="Form2_Activate"> <Mobile:Label runat="server" id="message" /> </Mobile:Form> |
Name | Function |
Command | Performs an action |
Form | Defines a container for mobile controls |
Image | Defines an image |
Label | Defines a text |
Link | Defines a hyperlink |
List | Defines a list |
MobilePage | Defines a container for mobile controls |
ObjectList | Defines a list of data objects |
Panel | Defines a container for other controls |
SelectionList | Defines a list to select from |
StyleSheet | Defines styles to be applied to other controls |
TextBox | Defines a single line input box |
TextView | Defines a multi-line input box |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Sub Page2(Sender as Object,E as EventArgs) If Page.IsValid Then ActiveForm=f2 text2.Text="You are " & age.text & " years old" end if End Sub </script> <Mobile:Form id="f1" runat="server"> <Mobile:CompareValidator runat="server" ControlToValidate="age" Type="Integer" ValueToCompare="18" Operator="GreaterThanEqual"> You must be at least 18 </Mobile:CompareValidator> <Mobile:Label runat="server">Age?</Mobile:Label> <Mobile:TextBox id="age" runat="server" /> <Mobile:Command OnClick="Page2" runat="server"> Submit</Mobile:Command> </Mobile:Form> <Mobile:Form id="f2" runat="server"> <Mobile:Label id="text2" runat="server" /> </Mobile:Form> |
Name | Function |
CompareValidator | Compares two values |
CustomValidator | Provides custom validation |
RangeValidator | Validates a range |
RegularExpressionValidator | Validates an expression |
RequiredFieldValidator | Validates required data |
ValidationSummary | Displays a validation summary |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Sub Show_Price(sender As Object,e As ListCommandEventArgs) text1.Text=e.ListItem.Text & "=" & e.ListItem.Value ActiveForm=f2 End Sub </script> <Mobile:Form id="f1" runat="server"> <Mobile:List runat="server" OnItemCommand="Show_Price"> <Item text="Volvo" value="$30,000" /> <Item text="BMW" value="$32,000" /> <Item text="Audi" value="$34,000" /> </Mobile:List> </Mobile:Form> <Mobile:Form id="f2" runat="server"> <Mobile:Label runat="server" id="text1" /> </Mobile:Form> |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Sub Car_Click(sender as Object, e as EventArgs) ActiveForm=f2 t1.text=cars.Selection.Value End Sub </script> <Mobile:Form id="f1" runat="server"> <Mobile:SelectionList runat="server" id="cars" > <Item Text="Volvo" Value="$30,000" /> <Item Text="BMW" Value="$32,000" /> <Item Text="Audi" Value="$34,000" /> </Mobile:SelectionList> <Mobile:Command runat="server" OnClick="Car_Click" Text="Submit" /> </Mobile:Form> <Mobile:Form id="f2" runat="server"> <Mobile:Label id="t1" runat="server" /> </Mobile:Form> |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <Mobile:Form runat="server"> <Mobile:Image runat="server"> <DeviceSpecific> <Choice ImageURL="image.gif" /> <Choice ImageURL="image.bmp" /> <Choice ImageURL="image.wbmp" /> </DeviceSpecific> </Mobile:Image> </Mobile:Form> |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <Mobile:Form runat="server"> <Mobile:AdRotator runat="server" AdvertisementFile="advertisements.xml"> </Mobile:AdRotator> </Mobile:Form> |
<?xml version="1.0" ?> <Advertisements> <Ad> <ImageUrl>image1.gif</ImageUrl> <BmpImageUrl>image1.bmp</BmpImageUrl> <WBmpImageUrl>image1.wbmp</WBmpImageUrl> <NavigateUrl>http://www.1.com</NavigateUrl> <AlternateText>Visit 1</AlternateText> </Ad> <Ad> <ImageUrl>image2.gif</ImageUrl> <BmpImageUrl>image2.bmp</BmpImageUrl> <WBmpImageUrl>image2.wbmp</WBmpImageUrl> <NavigateUrl>http://www.2.com</NavigateUrl> <AlternateText>Visit 2</AlternateText> </Ad> <Ad> <ImageUrl>image3.gif</ImageUrl> <BmpImageUrl>image3.bmp</BmpImageUrl> <WBmpImageUrl>image3.wbmp</WBmpImageUrl> <NavigateUrl>http://www.3.com</NavigateUrl> <AlternateText>Visit 3</AlternateText> </Ad> </Advertisements> |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <script runat="server"> Sub CalChanged(sender as Object,e as EventArgs) lab1.Text="You selected " & c1.SelectedDate ActiveForm=f2 End Sub </script> <Mobile:Form id="f1" runat="server"> <Mobile:Calendar id="c1" OnSelectionChanged="CalChanged" runat="server" /> </Mobile:Form> <Mobile:Form id="f2" runat="server"> <Mobile:Label id="lab1" runat="server" /> </Mobile:Form> |
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <Mobile:Form runat="server"> <Mobile:PhoneCall runat="server" PhoneNumber="(555) 555-5555" Text="Tove's number" AlternateFormat="{0}" /> </Mobile:Form> |
Name | Function |
AdRotator | Displays advertisements |
Calendar | Displays a calendar |
PhoneCall | Calls a telephone number |