Hide and visible RadioButton programmatically
RadioButton is an asp.net web server control. radiobutton server control have a built in property
to control its visibility.
radiobutton Visible property get or set a value indicating whether radiobutton control is rendered as UI on the web page. radiobutton Visible property value type is System.Boolean. it accept only one value from two possible values true and false. if we set the radiobutton Visible property value to 'true' then it will render as UI in web page. and if we set the Visible property value to 'false' then it will hide the radiobutton from web page.
the following asp.net c# example code demonstrate us how can we show or hide a radiobutton control programmatically at run time in an asp.net application web page.
radiobutton Visible property get or set a value indicating whether radiobutton control is rendered as UI on the web page. radiobutton Visible property value type is System.Boolean. it accept only one value from two possible values true and false. if we set the radiobutton Visible property value to 'true' then it will render as UI in web page. and if we set the Visible property value to 'false' then it will hide the radiobutton from web page.
the following asp.net c# example code demonstrate us how can we show or hide a radiobutton control programmatically at run time in an asp.net application web page.
RadioButtonVisible.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
RadioButton1.Visible = false;
RadioButton2.Visible = false;
}
protected void Button2_Click(object sender, System.EventArgs e)
{
RadioButton1.Visible = true;
RadioButton2.Visible = true;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to show, hide, visible RadioButton programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green">RadioButton Example: Hide, Visible</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
ForeColor="Crimson"
Text="Favorite Color?"
>
</asp:Label>
<br />
<asp:RadioButton
ID="RadioButton1"
runat="server"
Text="LawnGreen"
GroupName="Colors"
/>
<asp:RadioButton
ID="RadioButton2"
runat="server"
Text="LightCyan"
GroupName="Colors"
/>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="Crimson"
Text="Hide RadioButton"
OnClick="Button1_Click"
Font-Bold="true"
/>
<asp:Button
ID="Button2"
runat="server"
Font-Bold="true"
ForeColor="Crimson"
Text="Visible RadioButton"
OnClick="Button2_Click"
/>
</div>
</form>
</body>
</html>


