Label Control – ASP.Net

Label – ASP.Net Server Control

The Label control is used to display formatted text on web page in asp.net.

Label is a most frequently and common asp.net control for display text on web page. Label control display a text which is set through the Text property. In website application the most frequently used controls are Button control, Textbox control and Label control. We can change label style format by changing label control property.

Label Control in ASP.Net

Step 1 – Open the Visual Studio –> Create a new empty Web application.

Step 2 – Add New web form from Solution Explorer

Step 3 – Drag and drop Label control on web page from Toolbox.

Step 4 – Set ID and Text property of Label Control.

Let understand more about label with an example.

We already know that all server side control placed inside the Toolbox panel. Drag and drop Label control from toolbox to asp.net web page.

Label Control in ASP.Net

ASP.Net Label Server Control.

Now, assign text in a Label control to use Text property. Set text value in label Text property which is displayed in label control.

Here, below figure we assign “Meera Academy” to Label Text property.

Label Control in ASP.Net

ASP.Net Label Server Control.

In above label control figure we assign statically text in label control.
Now, we can also assign text to label programmatically  by writing c# code. We can change Label text by changing Text property programmatically  by writing code in asp.cs page.

Label1.Text = “Meera Academy”;

ASP.Net Label server control.

Set Label Text property through C# Programming.

Lets see some importance properties of label control.

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *