ASP.NET Mobile MobilePage Control[转]

Definition and Usage
定义和用法

The MobilePage control defines a base class for all mobile pages.
MobilePage控件的作用是:为所有的移动页面定义一个基准类。

A mobile page requires two directives:
一个移动页面包含两个指令:

  • The Page directive
    页面指令
  • The Register directive
    注册指令

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 "Mobile",  but you can use any prefix you like.
注册指令定义了为移动空间所使用的前缀。我们已经使用过“Mobile”了,但是你可以使用所有你喜欢使用的前缀。

A mobile page starts with something like this:
一个移动页面可以通过下面这种语法开始:

<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="Mobile"

Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>

 


Properties
属性

Property
属性
Description
描述
Assembly Required. Points to the assembly where the namespace resides
必要参数。指定命名空间的集中位置
Inherits Required. Specifies a class that this page should inherit from. If the page inherits directly from a MobilePage object, set this property to the "System.Web.UI.MobileControls.MobilePage" namespace. If the page inherits from a code-behind class, the name of the class must be specified instead
必要参数。指定该页面需要继承的类。如果页面直接继承了一个MobilePage[移动页面]对象,那么将这个属性设置为“System.Web.UI.MobileControls.MobilePage”命名空间。如果页面继承了“code-behind”类,必需指定类名称替代
Language Optional. Specifies the scripting language used on the page
可选参数。指定在页面中使用的脚本语言
NameSpace Required. The namespace to use for mobile server controls
必要参数。指定为移动服务器控件使用的命名空间
TagPrefix Required. The tag prefix to use
必要参数。指定使用的标签前缀

Example 1
案例1

The following example will display "Hello W3POP" in a Label control in an .aspx file:
下面的案例将显示 .aspx文件的标签空间中的“Hello W3POP”:

<%@ 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>

posted on 2009-03-17 17:10  黄裳  阅读(279)  评论(0)    收藏  举报

导航