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!

Property

Property Description
runat Specifies that the control is a server control. It 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.

Standard Control Properties

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

For a complete description, please visitStandard Control 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 is executed. This subroutine copies the content of the TextBox control to the Label control.