---
title: "RadioButton Control in ASP.Net"  
description: "Radio Buttons are used when we need to make multiple sets of choices available, but we want the user to select only one of them. If they click on a se"  
author: "Pushpendra Singh"  
published: 2010-10-14  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/166/radiobutton-control-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# RadioButton Control in ASP.Net

Radio Buttons are used when we need to make [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) sets of choices available, but we want the user to [select](https://www.mindstick.com/forum/34066/use-select-operator-in-linq) only [one of them](https://answers.mindstick.com/qa/47593/what-are-the-prevalent-water-proofing-systems-write-a-short-notes-on-any-one-of-them). If they click on a [second](https://yourviews.mindstick.com/view/82433/the-second-wave-new-covid-19-vs-old-covid-19) [selection](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) after making a first, the first selection is removed and replaced by the second.\

```
<asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" GroupName="a" /><asp:RadioButton ID="RadioButton2" runat="server" Text="No" GroupName="a" />
```

[Group](https://yourviews.mindstick.com/view/83502/uae-based-billionaire-yussuf-ali-s-lulu-group-enters-uttar-pradesh-supermarket) name of both [RadioButton](https://www.mindstick.com/blog/233/get-checked-radiobutton-using-javascript) should be same so that user can select ony one

![RadioButton Control in ASP.Net](https://www.mindstick.com/mindstickarticle/c79e1568-ff72-4eb3-ab18-32fcaeccc3e1/images/a2d52b32-7c43-4256-a734-c8ad16323561.png)

Main event of RadioButton is CheckedChanged event.

```
<asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" GroupName="a"  AutoPostBack="True" oncheckedchanged="RadioButton1_CheckedChanged" /><br /><asp:RadioButton ID="RadioButton2" runat="server" Text="No" GroupName="a"  AutoPostBack="True" oncheckedchanged="RadioButton2_CheckedChanged" /><asp:Label ID="Label1" runat="server"></asp:Label><asp:Label ID="Label1" runat="server"></asp:Label>
```

When you select the given option then CheckedChanged event will fire if AutoPostBack="True".

**Function to handle CheckChanged Event.**

```
  protected void RadioButton1_CheckedChanged(object sender,  EventArgs e){ if (RadioButton1.Checked) {Label1.Text = "You selected " + RadioButton1.Text; }}  protected void RadioButton2_CheckedChanged(object sender,  EventArgs e){ if (RadioButton2.Checked) {Label1.Text = "You selected " + RadioButton2.Text; }}
```

![RadioButton Control in ASP.Net](https://www.mindstick.com/mindstickarticle/c79e1568-ff72-4eb3-ab18-32fcaeccc3e1/images/bbdff2d1-f9e2-4dc5-af6d-cfa7b839d77b.png)

When you select the given [option](https://www.mindstick.com/forum/158788/what-is-rust-s-option-type-and-how-is-it-used-for-handling-nullable-values) then CheckedChanged event will fire and it will show the [selected value](https://www.mindstick.com/forum/525/get-selected-value-of-datagridviewcomboboxcolumn) in Label.

## We can change RadioButton appearance

```
<asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True"  Font-Bold="True" Font-Italic="True" Font-Names="Arial" ForeColor="Red"  Text="Yes" />        <asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True"  Font-Bold="True" Font-Italic="True" Font-Names="Arial" ForeColor="Red"  Text="No" />
```

![RadioButton Control in ASP.Net](https://www.mindstick.com/mindstickarticle/c79e1568-ff72-4eb3-ab18-32fcaeccc3e1/images/1b1158a0-be6c-4994-a8b2-d65d489e20aa.png)

---

Original Source: https://www.mindstick.com/articles/166/radiobutton-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
