【发布时间】:2015-07-16 22:38:20
【问题描述】:
我有一个 ListView 来创建几个 RadioButtonList,然后我想在单击按钮后从每个 RadioButtonList 中获取选定的值。
<asp:ListView ID="lvForm" runat="server">
<ItemTemplate>
<li>
<asp:Label runat="server" Text='<%# Eval("Texto") %>' />
<br />
<asp:RadioButtonList runat="server">
<asp:ListItem Text="<%$ Resources:liSim.Text %>" Value="<%$ Resources:liSim.Text %>" />
<asp:ListItem Text="<%$ Resources:liNao.Text %>" Value="<%$ Resources:liNao.Text %>" />
</asp:RadioButtonList>
</li>
</ItemTemplate>
<ItemSeparatorTemplate />
<LayoutTemplate>
<ol style="list-style-type: upper-alpha;">
<li id="itemPlaceholder" runat="server" />
</ol>
</LayoutTemplate>
</asp:ListView>
<asp:Button runat="server" ID="btnSeguinte" Text="<%$ Resources:btnSeguinte.Text %>" OnClick="btnSeguinte_Click" />
最好的解决方案是对每个 RadioButtonList 执行 OnSelectedIndexChanged 并在每次更改后继续保存。但是这种解决方法会在每次更改时强制转到服务器端。
如何仅在单击按钮后收集所有选定的值?
【问题讨论】:
-
javascript 是你最好的朋友
-
您点击的这个按钮在哪里,是什么?
标签: c# asp.net listview radiobuttonlist ascx