Previous | Home | Next |
It is used to provide the static information on the webform. Common properties for all the server side controls
Properties | Description |
Id | Used to specify the unique identifier for the control placed on the webform. |
runat="Server" | all control run on sever |
Text | It is used to set or get the value from the server side control.. |
The attribute is used to uniquely identify the <asp:label> control so you can refer to it in your ASP.NET code. The runat="server" attribute tells the server to process the control and generate HTML code to be sent to the client.
The class hierarchy for this control is as follows
- Object
- Control
- Web Control
- Label
Syntax of Label Control
<asp: Label ID="Label1" runat="server" Text="This is a label control"> </asp: Label>
Simple Example of Lebel Control
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = "Hi I AM Label control" End Sub
Click On Button
![](labe.gif)
How To Write Line Break In ASP.NET Label Control
To write text in lines in standard ASP.NET label control you need to use HTML tag <br />. This is example label control that contains text in Four Lines lines:
<asp:Label ID="Label1" runat="server" Text="This is Aditya<br />This is kamal<br /> This is Anil<br/> This is Ashish"> </asp:Label>
Previous | Home | Next |