Javatpoint Logo
Javatpoint Logo

ASP.NET Web Forms Label

This control is used to display textual information on the web forms. It is mainly used to create caption for the other controls like: textbox.

To create label either we can write code or use the drag and drop facility of visual studio 2017.

This is server side control, asp provides own tag to create label. The example is given below.

This control has its own properties that are tabled below.

Property Description
AccessKey It is used to set keyboard shortcut for the label.
TabIndex The tab order of the control.
BackColor It is used to set background color of the label.
BorderColor It is used to set border color of the label.
BorderWidth It is used to set width of border of the label.
Font It is used to set font for the label text.
ForeColor It is used to set color of the label text.
Text It is used to set text to be shown for the label.
ToolTip It displays the text when mouse is over the label.
Visible To set visibility of control on the form.
Height It is used to set height of the control.
Width It is used to set width of the control.

Example

// WebControls.aspx

This is a property window of label control.

ASP Label 1

Output:

Here, we have used label control with two different controls. It produces the following output.

ASP Label 2
Next TopicASP.NET TextBox




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA