.NET Mobile Forms are specialized web forms designed to work on different mobile devices.
.NET Mobile窗口是用于在不同的Mobile装置工作的特殊的网页窗口。
Mobile Pages
Mobile页面
A mobile page is much the same as an ordinary .NET web page. It is a text file with an aspx extension, and it can contain a variety of web controls.
Mobile页面很像普通的.NET网页页面,它是一份扩展名为“aspx”的文本文件,而且它能包含很多种网页控件。
The difference is the page directive that identifies the page as a mobile page, and the controls used on the page, which are mobile controls.
不同之处在于页面指示把页面识别为Mobile页面,以及页面使用的控件是Mobile控件
The mobile controls can be programmed device-independently, and the page will produce an output that suits the device that access it.
Mobile控件可以设计为使部件独立的,并且页面会产生与访问页面的部件相配的输出文件。
Mobile Forms
Mobile窗口
Each mobile page must have at least one mobile form, and each mobile form can have a number of mobile controls.
每页Mobile页面必须至少有一个Mobile窗口,每个Mobile窗口可以有大量的Mobile控件
Note that mobile pages can have multiple mobile forms. This is due to the nature of mobile devices. Mobile devices have small screens and it is very normal to navigate between screens with a simple link.
要注意Mobile页面可以有多重的Mobile窗口。这是由Mobile装置的性质决定的。Mobile装置的窗口很小,所以通过简易的链接在页面之间自由穿行是很普遍的。
Automatic Paging
自动调度页面
.NET Mobile supports automatic paging for different mobile devices.
.NET Mobile支持对不同Mobile装置的自动页面调度。
The paging is handled differently for each control. For example when paging takes place the controls included in a panel control will stay together.
对于页面调度(paging)的方法对于不同空间来说是有区别的。举例来说,当进行页面调度时,一块面板里的所有控件都会聚在一起。
Displaying Text
显示文本
This mobile page uses a TextView control to display a large amount of text:
这页Mobile页面使用了TextView(文本浏览)控件来显示大量文本。
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile"
Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<Mobile:Form runat="server"> <Mobile:TextView runat="server"> This is a very long text to demonstrate how text can be displayed over several screens. This is a very long text to demonstrate how text can be displayed over several screens. This is a very long text to demonstrate how text can be displayed over several screens. This is a very long text to demonstrate how text can be displayed over several screens. </Mobile:TextView>
</Mobile:Form>
|
When this page is displayed on a mobile device, the navigation and display functions of the page will be compiled differently for different devices with different display characteristics.
当这页在Mobile装置上显示时,对于有不同显示特征的不同部件,页面的操纵和显示函数也会被编译得不同。
When the text is displayed on a pocket PC with a small display, the user will be able to scroll the text with a scroll bar, but on a cell phone the text will be displayed over several screens with proper navigation tools added.
当文本在小型显示屏的pocket PC上显示时,用户可以使用滚动条滚动文本,但在手机上,通过添加适当的操作工具,文本文件将会在几个不同的屏幕上显示。
Note that all mobile controls must have the runat attribute set to "server", in order to secure proper rendering of the page for different devices.
要注意所有的Mobile控件的runat属性必须设置为"server",这样可以确保合理地显示不同的部件页面。
Single Forms
单一窗口
This mobile page has one form:
这页Mobile页面有一个窗口
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<Mobile:Form runat="server"> <Mobile:Label runat="server">Hello W3POP </Mobile:Label> </Mobile:Form>
|
Multiple Forms
多窗口
This mobile page has two forms:
这页Mobile页面有两个窗口
<%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"%> <%@ Register TagPrefix="Mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<Mobile:Form id="f1" runat="server">
<Mobile:Label runat="server">Hello W3POP </Mobile:Label> <Mobile:Link runat="server" NavigateURL="#f2">2 </Mobile:Link> </Mobile:Form>
<Mobile:Form id="f2" runat="server"> <Mobile:Label runat="server">Hello Again </Mobile:Label> <Mobile:Link runat="server" NavigateURL="#f1">1 </Mobile:Link>
</Mobile:Form>
|
Links
链接
Note the <Mobile:Link> element in the example above. The link control lets the user navigate between the two mobile forms.
注意上述例子里的<Mobile:Link>元素。Link(链接)控件使用户可以在两个Mobile窗口间操作。