Introduction
The Label control is used to display the text that the user cannot edit. The label control exists within the System.Web.UI.WebControls namespace.
Public properties of the Label class
AssociatedControlID : Obtains or sets the identifier for a server control the Label control is associated with.
Text : Obtains or sets the text content of the Label control.
BackColor : Obtains or sets the back color of the Label.
Related Top Article
How to bind label control in asp.net
Example of Change label color dynamically
The Label control is used to display the text that the user cannot edit. The label control exists within the System.Web.UI.WebControls namespace.
Public properties of the Label class
AssociatedControlID : Obtains or sets the identifier for a server control the Label control is associated with.
Text : Obtains or sets the text content of the Label control.
BackColor : Obtains or sets the back color of the Label.
Related Top Article
How to bind label control in asp.net
Example of Change label color dynamically
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = " Welcome to www.id-script.com";
Label1.BackColor = System.Drawing.Color.Green;
Label1.ForeColor = System.Drawing.Color.Orange;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Output<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = " Welcome to www.id-script.com";
Label1.BackColor = System.Drawing.Color.Green;
Label1.ForeColor = System.Drawing.Color.Orange;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
Tidak ada komentar:
Posting Komentar