The Mobile ASP.NET Page
Mobile Controls are the main building blocks of mobile applications.
Mobile Controls(手机控件)是手机应用程序的主要组件。
Mobile Controls are similar to Web Controls in ASP.NET.
Mobile Controls(手机控件)和ASP.NET的Web Controls(网页控制)很像。
The following ASP.NET page displays "Hello W3Schools" as a WML card in a WML enabled cell phone:
下面的ASP.NET页面把"Hello W3Schools"作为一个WML卡显示在WML可用的手机里。
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mob" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<mob:Form runat="server"> <mob:Label runat="server">Hello W3POP</mob:Label>
</mob:Form>
|
The Page directive tells ASP to use (inherit) mobile page handling instead of regular page handling (like the one used for traditional browsers).
页面指示告诉ASP用手机页面处理代替常规页面处理(像用于传统浏览器的处理)
The Register directive defines the prefix that will be used for mobile controls. We have used "mob", but you can use any prefix you like.
登记指示定义了将用于手机控件的前缀。在这我们用了"mob",但前缀是可任意取的。
The <mob:Form> element tells the server to create a mobile form control.
<mob:Form>元素告诉服务器创建一个手机窗口控制
The <mob:Label> element tells the server to create a mobile label control with the text "Hello W3Schools".
<mob:Label>元素告诉服务器创建一个含有文本"Hello W3Schools"的手机标签控制
When the ASP .NET page executes, it will produce the following output to a WAP enabled mobile phone:
当ASP .NET执行时,会在WAP可用的手机上产生这样的输出
<?xml version='1.0'?>
<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN' 'http://www.wapforum.org/DTD/wml_1.1.xml'>
<wml> <card> <p>Hello W3POP</p> </card> </wml>
|
and this output will be produced for a Pocket PC:
对于Pocket PC(微型电脑)来说,会输出以下内容:
<html>
<body>
<form id="ctrl1" name="ctrl1" method="post" action="example.aspx"> <div>Hello W3POP</div>
</form>
</body> </html>
|
Conclusion
综述
.NET Mobile will generate WML code for WAP enabled cell phones and HTML code for devices like the Pocket PC.
.NET Mobile会为WAP产生一个WML代码,它可以使手机使用WAP,以及让微型电脑(Pocket PC)装置支持HTML代码。
By detecting the browser, .NET Mobile will output correct content, providing developers with a powerful tool to develop single applications that will serve many different mobile devices.
通过探测浏览器,.NET Mobile将会输出一段正确内容,并通过一个强大的工具开发出一个单独的应用程序(此应用程序支持不同的移动设备)将这部分内容提供给开发者。