ASP.NET Mobile Form Control[转]

Definition and Usage
定义和用法

The Form control defines a container for mobile controls.
表单控件的作用是:为移动控件定义一个容器。

Each mobile page must have at least one Form control, and each Form control can have a number of mobile controls.
每个移动页面至少必须包含一个表单控件,每个表单控件可以包含多个移动控件。

Note that mobile pages can have multiple Form controls. This is due to the nature of mobile devices. Mobile devices have small screens and it is very normal to navigate between screens with simple links.
注意:移动页面可以包含多个表单控件。这是根据移动设备的特性决定的。移动设备的屏幕很小,因此,通过简单的链接来进行屏幕之间的导航显得非常普遍。


Properties
属性

Property
属性
Value
Description
描述
Action URL Optional. A URL that defines where to send the data when the form is submitted
可选参数。指定当提交表单时,将数据发送到的具体位置(URL)
Alignment left
center
right
Optional. How to align the form
可选参数。指定表单的对齐方式
BackColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A background color for the form
可选参数。指定表单的背景色
ForeColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A foreground color for the form
可选参数。指定表单的前景色
Font-Bold false
true
Optional. Specifies whether or not the text in the form should be bold
可选参数。指定表单中的文本字体是否应该以粗体显示
Font-Italic false
true
Optional. Specifies whether or not the text in the form should be italic
可选参数。指定表单中的文本字体是否应该以斜体显示
Font-Name fontname Optional. Specifies the font name of the text in the form
可选参数。指定表单文本的字体名称
Font-Size normal
small
large
Optional. Specifies the font size of the text in the form
可选参数。指定表单中文本的字体大小
id unique_name Optional. A unique id for the control
可选参数。为控件指定一个独立的id
Method post
get
Optional. How the form posts data to the server. Default is "post"
可选参数。指定数据发送至服务器的方式。默认方式为“post”
OnActivate function_name Optional. The name of the function to be executed when form is activated
可选参数。指定当表单被激活时,需要执行的函数名称
OnDeactivate function_name Optional. The name of the function to be executed when form is deactivated
可选参数。指定当表单被解除时,需要执行的函数名称
OnPaginate function_name Optional. The name of the function to be executed when form is paginated
可选参数。指定当表单标上页码时,需要执行的函数名称
Paginate true
false
Optional. Whether the form is to be paginated
可选参数。指定是否需要将表单标上页码
runat "server" Required. Specifies that the control is a server control
可选参数。指定该控件为“服务器”控件
StyleReference name_of_style_element Optional. Specifies a reference to a style to be applied to the control
可选参数。指定一个应用于控件的样式参数
Title form_title Optional. The title of the form
可选参数。指定表单的标题
Wrapping wrap
nowrap
Optional. Specifies whether or not the text in the form should wrap
可选参数。指定表单中的文本是否可以被嵌套

Example 1
案例1

The following example has one form control, and it 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>

Example 2
案例2

The following example will declare two forms in an .aspx file. The first form has a label with the text "Age?", an input box to input the age, and a submit button. The second form is activated by the submit button on the first form, and displays a response:
下面这个案例在 .aspx 文件中声明了两个案例。第一张表单包含名为 “Age?”的标签,一个输入框和一个提交按钮。第二个表单将通过第一个表单的提交按钮激活,并显示一段回应文字:

<%@ Page
Inherits="System.Web.UI.MobileControls.MobilePage"%>
<%@ Register TagPrefix="Mobile"
Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<script runat="server">
Dim age
Sub AgeClick(sender As Object, e As EventArgs)
age=text1.Text
ActiveForm=Form2
End Sub
Sub Form2_Activate(sender As Object,e As EventArgs)
message.Text="You are " & age & " years old"
End Sub
</script>
<Mobile:Form id="form1" runat="server">

<Mobile:Label runat="server">Age?</Mobile:Label>
<Mobile:TextBox runat="server" id="text1" />
<Mobile:Command runat="server" OnClick="AgeClick"

Text="Submit" />
</Mobile:Form>
<Mobile:Form id="form2" runat="server"
OnActivate="Form2_Activate">

<Mobile:Label runat="server" id="message" />
</Mobile:Form>

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

导航