移动 .NET 表单
移动 .NET 表单是一种为工作在不同移动设备而设计的特殊 Web 表单。
移动页面
移动页面和原始 .NET Web 页面是非常相似。它是一个 aspx 扩展的文本文件并且具有了 Web 控件的多样性( and it can contain a variety of web controls )。
两者的不同是移动页面使用移动页面标签标识页面,移动控件使用在页面。
移动控件编程是有设备依赖性的,页面将为访问设备产生合适的输出。(译者注:就是不同的控件对不同的移动设备呈现的效果是不同的。)
移动表单
每个移动页面最少有一个移动表单,并且每个移动表单可以有一定数量的移动控件。
注意:移动页面可以有多个移动表单。这是因为移动设备的实际情况。移动设备拥有小的屏幕所以通过简单的链接在屏幕间导航是非常正常的。
自动分页
移动 .NET 支持在不同的移动设备上自动分页的功能。
每个控件的分页的处理是不同的, For example when paging takes place the controls included in a panel control will stay together 。
显示文本
这个移动页面使用 TextView 控件显示一个字符很多的文本( a large amont of text )。
1@ Page
2
3Inherits=
4
5"System.Web.UI.MobileControls.MobilePage"
1@ Register
2
3TagPrefix="Mobile"
4
5Namespace="System.Web.UI.MobileControls"
6
7Assembly="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.
当这个页面显示在移动设备上的时候,页面的导航和显示功能将为不同的设备被编译成不同的显示特性。
当这个文本显示在小的显示屏幕的 Pocket PC 的时候,使用者可以通过调节滚动条来滚动文字,但是在手机上这个文本将会显示在添加了适当的导航工具的几个屏幕上。
注意:为了可靠适当的为不同设备呈现页面,所有的移动控件必须将 Runat 属性设置成 Server (译者注:就像标准的 ASP.NET 页面)
单个表单
这个移动页面包含一个表单:
1@ Page
2
3Inherits=
4
5"System.Web.UI.MobileControls.MobilePage"
1@ Register
2
3TagPrefix="Mobile"
4
5Namespace="System.Web.UI.MobileControls"
6
7Assembly="System.Web.Mobile"
< Mobile :Form runat="server">
< Mobile :Label runat="server">Hello W3Schools
多个表单
这个移动页面包括两个表单:
1@ Page
2
3Inherits=
4
5"System.Web.UI.MobileControls.MobilePage"
1@ Register
2
3TagPrefix="Mobile"
4
5Namespace="System.Web.UI.MobileControls"
6
7Assembly="System.Web.Mobile"
< Mobile :Form id="f1" runat="server">
< Mobile :Label runat="server">Hello W3Schools
< Mobile :Link runat="server" NavigateURL="#f2">2
< Mobile :Form id="f2" runat="server">
< Mobile :Label runat="server">Hello Again
< Mobile :Link runat="server" NavigateURL="#f1">1
超级链接
注意:在上面的例子种
1<molile:link> 标签。这个连接控件让用户在两个移动表单之间进行导航。</molile:link>