[英]How to select just one option in RadioButtonList within a repeater with postback
我在Repeater
有一个RadioButtonList
,我想一次只选择一个选项。 但是对于动态创建的每个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>
当控件在列表绑定控件中呈现时,ID将更改为唯一,因此JavaScript可以使用它。 这里有一个很棒的论坛帖子,它包括一个解决方法。
http://forums.asp.net/t/1378112.aspx?RadioButtonList+in+a+Repeater+GroupName
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.