Unchecked RadioButton programmatically
RadioButton is an asp.net web server control. we can unchecked a checked radiobutton programmatically
at run time.
radiobutton Checked property get or set a value indicating whether the radiobutton is checked (selected). radiobutton Checked property value type is System.Boolean. so it accept only true or false as Checked property value. if we set the Checked property value to true then the web page display the radiobutton is checked. and if we apply the radiobutton Checked property value to 'false' then the radiobutton will be render as unchecked (deselected).
the following asp.net c# example code demonstrate us how can we unchecked a radiobutton dynamically at run time in an asp.net application.
radiobutton Checked property get or set a value indicating whether the radiobutton is checked (selected). radiobutton Checked property value type is System.Boolean. so it accept only true or false as Checked property value. if we set the Checked property value to true then the web page display the radiobutton is checked. and if we apply the radiobutton Checked property value to 'false' then the radiobutton will be render as unchecked (deselected).
the following asp.net c# example code demonstrate us how can we unchecked a radiobutton dynamically at run time in an asp.net application.
RadioButtonUnChecked.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, System.EventArgs e)
{
if(!this.IsPostBack)
{
RadioButton1.Checked = true;
}
}
protected void Button1_Click(object sender, System.EventArgs e)
{
RadioButton1.Checked = false;
RadioButton2.Checked = false;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to unchecked RadioButton programmatically</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Navy">RadioButton Example: Unchecked</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Bold="true"
ForeColor="Indigo"
Text="Favorite Color?"
>
</asp:Label>
<br />
<asp:RadioButton
ID="RadioButton1"
runat="server"
Text="LightBlue"
GroupName="Colors"
/>
<asp:RadioButton
ID="RadioButton2"
runat="server"
Text="LightCoral"
GroupName="Colors"
/>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
ForeColor="Indigo"
Text="Unchecked RadioButton"
OnClick="Button1_Click"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>

