Show and hide HyperLink control
HyperLink is an asp.net web server control. hyperlink server control allow us to display a link
to another web page. hyperlink control have a built in property to show or hide link programmatically
at run time.
hyperlink Visible property get or set a value that indicates whether hyperlink control is rendered as UI in web browser. so, by using this property we can programmatically hide or visible a hyperlink in asp.net page at run time. this property value type is System.Boolean. we can assign only true or false for this property value. if we set the Visible property value to false then it will hide hyperlink control from web browser. Visible property value true indicate the hyperlink server control will be display in web browser.
the following asp.net c# example code demonstrate us how can we show or hide hyperlink server control in an asp.net web page dynamically at run time.
hyperlink Visible property get or set a value that indicates whether hyperlink control is rendered as UI in web browser. so, by using this property we can programmatically hide or visible a hyperlink in asp.net page at run time. this property value type is System.Boolean. we can assign only true or false for this property value. if we set the Visible property value to false then it will hide hyperlink control from web browser. Visible property value true indicate the hyperlink server control will be display in web browser.
the following asp.net c# example code demonstrate us how can we show or hide hyperlink server control in an asp.net web page dynamically at run time.
HyperLinkVisible.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
HyperLink1.Visible = false;
Label1.Text = "HyperLink Now Hide";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
HyperLink1.Visible = true;
Label1.Text = "HyperLink Now Visible";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to show, hide, visible HyperLink</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Red">HyperLink Example: Show Hide</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
Font-Italic="true"
Font-Bold="true"
ForeColor="DodgerBlue"
>
</asp:Label>
<br /><br />
<asp:HyperLink
ID="HyperLink1"
runat="server"
Text="CheckBox Font Size Example"
Font-Size="Large"
Font-Bold="true"
NavigateUrl="~/CheckBox/CheckBoxFontSize.aspx"
>
</asp:HyperLink>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="PaleVioletRed"
Text="Hide HyperLink"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="PaleVioletRed"
Text="Show HyperLink"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>