How to Deselect All From a RadioButtonList in C#

Unlike a list of check boxes, a list of radio buttons is designed to allow users to select only one option. However, once an option is selected for a radio button, it is now more difficult to deselect all options. However, a C# function ClearSelection, will allow the selection to be cleared.

In our example below is a RadioButtonList called rblSelectAOption:

<asp:RadioButtonList ID="rblSelectAOption" runat="server">
<asp:ListItem>One</asp:ListItem>
<asp:ListItem>Two</asp:ListItem>
<asp:ListItem>Three</asp:ListItem>
</asp:RadioButtonList>

Next, the codebehind below will clear all selected option:

rblSelectAOption.ClearSelection();

That’s all it takes!

Share and Enjoy:
  • Digg
  • DotNetKicks
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Live
  • MySpace
  • Netvibes
  • Reddit
  • StumbleUpon
You can leave a response, or trackback from your own site.

4 Responses to “How to Deselect All From a RadioButtonList in C#”

  1. Vikas says:

    Thnx a lot… ;)

  2. jayant says:

    superb…

  3. Vishal says:

    Works like a charm.

Leave a Reply