I have a RadioButtonList
inside of Repeater
and I want to select just one option at a time. But for each RadioButtonList created dynamically I can select multiple options in each RadioButtonList.
How can I select one option and deactivate the previous selection?
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="ItemBound">
<ItemTemplate>
<h4><label id="header" runat="server"><%# Eval("Description") %></label></h4>
<asp:UpdatePanel ID="panel" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="rdo" RepeatDirection="Vertical" runat="server" OnSelectedIndexChanged="rdo_SelectedIndexChanged" AutoPostBack="true" ClientIDMode="AutoID"></asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</ItemTemplate>
</asp:Repeater>
When a control is rendering in a list bound control, the ID is changed to be unique so JavaScript can work with it. There is a great forum post here about this, and it includes a work-around.
http://forums.asp.net/t/1378112.aspx?RadioButtonList+in+a+Repeater+GroupName