【发布时间】:2016-11-12 21:16:05
【问题描述】:
如何在代码后面获取 RadioButtonList 选择的值,以便我可以在 SQL 数据库中写入数据。
我正在创建与数据库表中的问题一样多的 RadiobuttonList。现在我面临着如何获得每个问题(每一行)的答案(RadioButtonList 值)的困难。
我怎样才能获得每个动态创建的 RadioButtonList 的 RadioButtonList 值。
<asp:Repeater ID="RepeaterHeading1" runat="server" DataSourceID="SDSHeading">
<ItemTemplate>
<div class="row">
<asp:HiddenField ID="HiddenFieldHeadingId" runat="server" Value='<%# Eval("Form_Heading_Id") %>' />
<div class="col-md-12">
<h4 class="h4" style="font-weight: bold"><%# Eval("Form_Heading_Name") %></h4>
</div>
<asp:Repeater ID="RepeaterQuestion1" runat="server" DataSourceID="SDSQuestion">
<ItemTemplate>
<div class="col-lg-8">
<%# Eval("Form_Question") %>
</div>
<div class="col-lg-4">
<asp:RadioButtonList ID="RadioButtonList1" RepeatDirection="Horizontal" runat="server" Font-Size="Large" DataSourceID="SDSRadio" DataTextField="Value" DataValueField="Remarks_Id" RepeatLayout="Flow" CellSpacing="10"></asp:RadioButtonList>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</ItemTemplate>
</asp:Repeater>
【问题讨论】: