ASP.NET Label Control

Definition and Usage

The Label control is used to display text on the page. This text is programmable.

Note:This control allows you to apply styles to the content!

Properties

Properties Description
runat Specifies that the control is a server control. Must be set to "server".
Text The text displayed in the 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 complete description, please visit Web Control Standard Properties.

Control Standard Properties

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

For a complete description, please visitControl Standard Properties.

Example

Label
In this example, we declare a Label control, a TextBox control, and a Button control in the .aspx file. When the user clicks the button, the submit subroutine will be executed. This subroutine will copy the content of the TextBox control to the Label control.