【问题标题】:How to get the RadioButtonlist selected value inside a repeater?如何在中继器中获取 RadioButtonlist 选定值?
【发布时间】: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>

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    使用 javascript 循环浏览页面并选择所有选定的 RadioButtonList 值,存储在 javascript 数组中,然后将其发布到服务器。 如果您可以提供生成的 html 页面的示例。我可以使用 javascript 为您清除一些有效的东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-15
      • 2015-03-11
      • 1970-01-01
      • 2012-06-21
      • 1970-01-01
      • 1970-01-01
      • 2012-06-20
      • 2013-12-26
      相关资源
      最近更新 更多