RadioButtonList
内有Repeater
,我想一次只选一个选项。但是对于动态创建的每个 RadioButtonList ,我可以在每个 RadioButtonList 中选择多个选项。
如何选择一个选项并停用之前的选项?
<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>
答案 0 :(得分:0)
当控件在列表绑定控件中呈现时,ID将更改为唯一,以便JavaScript可以使用它。这里有一个很棒的论坛帖子,它包括一个解决方法。
http://forums.asp.net/t/1378112.aspx?RadioButtonList+in+a+Repeater+GroupName