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!
This entry was posted on Thursday, May 15th, 2008 at 7:26 am and is filed under C#. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Leave a Reply