ASP.NET Mobile Command Control[转]

Definition and Usage
定义和用法

The Command control is used to perform an action on a mobile device, like posting user input back to the server.
命令控件是用于在移动设备上执行一个指令的,如:将用户输入传给服务器。


Properties
属性

Property
属性
Value
Description
描述
Alignment left
center
right
Optional. How to align the command control
可选参数。指定命令控件的排列方式
BackColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A background color for the command control
可选参数。指定命令控件的背景颜色
BreakAfter true
false
Optional. Default is "true"
可选参数。默认值为“true”
CausesValidation true
false
Optional. By default, a page is validated when a Command control is clicked. To prevent a page from being validated when clicking on a Command control, set this property to "false"
可选参数。默认情况下,当点击命令控件时,页面生效;如果将属性设置为“false”,那么当点击命令控件时,页面失效
CommandArgument   Optional. Additional information about the command to perform
可选参数。指定与命令执行相关的附加信息
CommandName   Optional. The command associated with the ItemCommand event
可选参数。指定与 ItemCommand 事件相关的命令
EnableViewState true
false
Optional. Default is "true"
可选参数。默认值为“true”
Font-Bold false
true
Optional. Specifies whether or not the text in the command control should be bold
可选参数。指定命令控件的文本是否要以粗体显示
Font-Italic false
true
Optional. Specifies whether or not the text in the command control should be italic
可选参数。指定命令控件的文本是否要以斜体显示
Font-Name fontname Optional. Specifies the font name of the text in the command control
可选参数。指定命令控件的字体名称
Font-Size normal
small
large
Optional. Specifies the font size of the text in the command control
可选参数。指定命令控件的字体尺寸
ForeColor rgb(x,x,x)
#xxxxxx
colorname
Optional. A foreground color for the command control
可选参数。指定命令控件的前景色
Format button
link
Optional. Specifies whether the Command control should be a button or a link
可选参数。指定命令控件是一个按钮还是一个链接
id unique_name Optional. A unique id for the control
可选参数。为控件指定一个id
ImageUrl URL Optional. An URL to an image source
可选参数。指定链接到图象源的URL
OnClick function_name Optional. The name of the function to be executed when the control is clicked
可选参数。档控件被点击时,指定需要执行的函数名称
OnItemCommand function_name Optional. The name of the function to be executed when the control is activated
可选参数。档控件被激活时,指定需要执行的函数名称
runat "server" Required. Specifies that the control is a server control
必要参数。指定该控件是否是服务器控件
SoftkeyLabel softkeylabel Optional.
可选参数
StyleReference name_of_style_element Optional. Specifies a reference to a style to be applied to the control
可选参数。指定一个应用于控件的样式参数
Text text Optional. The text to display on the control
可选参数。指定控件上显示的文本
Visible true
false
Optional. Specifies whether or not the Command control should be visible
可选参数。指定命令控件是否可视
Wrapping wrap
nowrap
Optional. Specifies whether or not the text in the command control should wrap
可选参数。指定命令控件中的文本是否可以被嵌套

Example 1
案例1

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:55  黄裳  阅读(242)  评论(0)    收藏  举报

导航