To declare an ASP.NET mobile page (a mobile Web Form), simply create a file with an
.ASPX extension and place it in a Web folder.The ASPX page must contain the following
directives and at least one
form element:
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<mobile:Form id="Form1" runat="server">Hello</mobile:Form>
<mobile:Form id="Form2" runat="server">World</mobile:Form>
Comments
ASP.NET pages that use mobile controls must inherit from System.Web.UI.
MobileControls.MobilePage. Just like with a regular Web Form, you can also set
optional parameters such as Language in the Page directive.The second directive associates
the mobile prefix with the mobile control namespace.
Note that HTML constructs such as <HTML> and <BODY> are not present, as these tags
do not render properly in a mobile device that does not support HTML. One key difference
between a regular Web Form and a mobile Web Form is that you can have more
than one form control in a mobile Web Form.This allows a single Web Form to display
multiple screens in a mobile device using form elements.
Finally, note that mobile controls support are built into ASP.NET v1.1, which should
make the @ Register directive unnecessary.
No comments:
Post a Comment