Latest web development tutorials

ASP.NET Label control

Web Server Controls Web server control

Definition and Usage

Label controls are used to display text on the page. The text is programmable.

Note: This control allows you to apply a style content!


Attributes

属性 描述
runat 规定该控件是一个服务器控件。必须设置为 "server"。
Text 在 label 中显示的文本。

Web Control Standard Properties

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, SkinID, Style, TabIndex, ToolTip, Width

For a full description, visit the Web Control Standard Attributes .

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a full description, go to Control Standard Attributes .


Examples

Label
In this example, we declare a Label control in an .aspx file, a TextBox control, and a Button control. When the user clicks the button, the submit subroutine. The contents of the TextBox control subroutine will be copied to the Label control.


Web Server Controls Web server control