Examples: Label Web Server Control
Example 1:
<asp:Label id="Label1" runat="server">ASP.NET rocks!<asp:Label>
ASP.NET rocks!
Example 2:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" />
ASP.NET rocks!
Example 3:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" ForeColor="Red" />
ASP.NET rocks!
Example 4:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" BackColor="Yellow" />
ASP.NET rocks!
Example 5:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" Font-Bold="True" />
ASP.NET rocks!
Example 6:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" Font-Size="X-Large" />
ASP.NET rocks!
Example 7:
<asp:Label id="Label1" runat="server" Text="ASP.NET rocks!" Font-Name="Trebuchet MS"
Font-Underline="True" />ASP.NET
rocks!
Example 8:
<asp:Label id="Label1" runat="server" />
// C#
Label1.Text = "ASP.NET rocks!";
Label1.BorderStyle = "solid";
Label1.BorderColor = "#cccccc";
Label1.Font.Name = "Verdana";
Label1.Font.Size = "10pt";
Label1.Width = "200px";
ASP.NET
rocks!
Related links