Show, hide, visible LinkButton server control
LinkButton is an asp.net web server control which display a hyperlink-style button control in
web page. linkbutton server control have a built in property named Visible to programmatically
show or hide linkbutton in a web page.
linkbutton Visible property get or set a value that indicate whether linkbutton is rendered as UI in web page. this property value type is System.Boolean. this property value true means the linkbutton control will be visible in web page and false indicate the linkbutton will be hidden in web page. linkbutton Visible property allow us to control linkbutton visibility dynamically at run time.
the following asp.net c# example code demonstrate us how can we show or hide linkbutton control programmatically at run time in an asp.net application.
linkbutton Visible property get or set a value that indicate whether linkbutton is rendered as UI in web page. this property value type is System.Boolean. this property value true means the linkbutton control will be visible in web page and false indicate the linkbutton will be hidden in web page. linkbutton Visible property allow us to control linkbutton visibility dynamically at run time.
the following asp.net c# example code demonstrate us how can we show or hide linkbutton control programmatically at run time in an asp.net application.
LinkButtonVisible.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
LinkButton1.Visible = false;
Label1.Text = "LinkButton Now Hide";
}
protected void Button2_Click(object sender, System.EventArgs e)
{
LinkButton1.Visible = true;
Label1.Text = "LinkButton Now Visible";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to show, hide, visible LinkButton</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy">LinkButton Example: Show Hide</h2>
<asp:Label
ID="Label1"
runat="server"
ForeColor="SkyBlue"
Font-Size="Large"
Font-Italic="true"
Font-Bold="true"
>
</asp:Label>
<br /><br />
<asp:LinkButton
ID="LinkButton1"
runat="server"
Text="LinkButton Visible Test"
Height="25"
ForeColor="BlueViolet"
Font-Bold="true"
>
</asp:LinkButton>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="Magenta"
Text="Hide LinkButton"
Height="45"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
ForeColor="Magenta"
Text="Show LinkButton"
Height="45"
OnClick="Button2_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>



- How to set, change LinkButton style programmatically
- How to submit asp.net page by LinkButton control
- How to set, change LinkButton text programmatically
- How to use external link (url) in HyperLink control
- How to set, change HyperLink ForeColor (text, link color)
- How to use internal (application) link in HyperLink