asp.net example - label link
Label is an asp.net web server control. label control allow us to display text on web page.
unlike static text, we can customize the displayed text by using label control's Text property.
label server control can render some html tags such as <b>, <a> etc.
so we can display an active link on web page using label control. this help us to show link inside static text. we just need to place a well formatted html anchor tag in label control's Text property value.
the following asp.net c# example code demonstrate us how can we display an active link in a label control in an asp.net application.
so we can display an active link on web page using label control. this help us to show link inside static text. we just need to place a well formatted html anchor tag in label control's Text property value.
the following asp.net c# example code demonstrate us how can we display an active link in a label control in an asp.net application.
label-link.aspx
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Label1.Text = "asp.net c# examples blog....<br />";
Label1.Text += "<a href='http://asp-net-example.blogspot.com'>asp.net c# examples<a/>";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>asp.net example - label link</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:MidnightBlue; font-style:italic;">
asp.net example - label link
</h2>
<hr width="550" align="left" color="Gainsboro" />
<asp:Label
ID="Label1"
runat="server"
Text="sample label to test link inside label control."
Font-Size="X-Large"
>
</asp:Label>
<br /><br /><br />
<asp:Button
ID="Button1"
runat="server"
Text="label link"
OnClick="Button1_Click"
Height="40"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>
- How to change Label width using CSS
- How to align text to center in a Label
- How to databind Label
- How to display html tags in a Label
- How to trim text with ellipsis in a Label
- How to display an image in a Label
- How to justify the text in a Label
- How to add margin to a Label
- How to add top margin to a Label
- How add padding to a Label