ASP.NET Mobile Label Control[转]
Definition and Usage
定义和用法
The Label control is used to display a text on a mobile device.
标签控件的作用是:在一个移动设备上显示一段文本。
The text can be specified by the text attribute or as the content of the Label element. If the text is specified in both ways, the inner text takes precedence. However, if the text is programmatically set, the inner text is replaced with this text.
这段文本可以通过 text 属性指定,或者作为标签元素的内容被指定。如果该文本同时用这两个方法指定,那么将优先指定内置文本。然而如果文本是已经被计划设置的属性,那么内置文本将被该文本所取代。
Properties
属性
Property 属性 |
Value 值 |
Description 描述 |
---|---|---|
Alignment | left center right |
Optional. How to align the label 可选参数。指定标签的对齐方式 |
BackColor | rgb(x,x,x) #xxxxxx colorname |
Optional. A background color for the label 可选参数。指定标签的背景颜色 |
ForeColor | rgb(x,x,x) #xxxxxx colorname |
Optional. A foreground color for the label 可选参数。指定标签的前景颜色 |
Font-Bold | false true |
Optional. Specifies whether or not the text in the label should be bold 可选参数。指定标签文本字体是否以粗体显示 |
Font-Italic | false true |
Optional. Specifies whether or not the text in the label should be italic 可选参数。指定标签文本字体是否以斜体显示 |
Font-Name | fontname | Optional. Specifies the font name of the text in the label 可选参数。指定标签文本的字体名称 |
Font-Size | normal small large |
Optional. Specifies the font size of the text in the label 可选参数。指定标签文本的字体大小 |
id | unique_name | Optional. A unique id for the control 可选参数。为一个控件指定一个独立的id |
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 可选参数。指定一个应用于控件的样式参数 |
Text | text | Optional. The text to display in the label 可选参数。指定标签的显示文本 |
Wrapping | wrap nowrap |
Optional. Specifies whether or not the text in the label should wrap 可选参数。指定标签中的文本是否可以被嵌套 |
Example 1
案例1
The following example will display "Hello W3Schools" in a Label control in an .aspx file:
下面这个案例将在 .aspx 文件中的标签控件上显示“Hello W3POP”:
<%@ Page <Mobile:Form runat="server"> |
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 <script runat="server"> <Mobile:Form id="form1" runat="server"> <Mobile:Form id="form2" runat="server" |