日期:2014-05-17  浏览次数:20474 次

Repeater控件中套checkbox 插入checkbox 选中行的数据 每次只能插入第一条记录 【急】!!!


   <asp:Repeater ID="Repeater1" runat="server">
      <ItemTemplate>    

           <div class="order">订购请勾选
         <asp:CheckBox ID="CheckBox1" runat="server" CssClass='<%#Eval("序号") %>' />
          &nbsp;&nbsp;&nbsp;&nbsp;数量&nbsp;&nbsp;
         <asp:TextBox runat="server" id="text3" class="numbers" ></asp:TextBox>
           </div>
          </div>
  
      </ItemTemplate>
   </asp:Repeater>



                for (int i = 0; i < Repeater1.Items.Count; i++)
                {
                
                    int num = Convert.ToInt32(((TextBox)Repeater1.Items[i].FindControl("text3")).Text);
                    CheckBox cb = (CheckBox)Repeater1.Items[i].FindControl("CheckBox1");
                    if (cb.Checked)
                    {
                        strsql = "insert into tmwsc_uesr_dd (产品序号,数量)values('"+ cb.CssClass +"','"+ num + "')";
                        bool zz = Das.ExecSql(strsql);
 

                    }
                }


每次添加 都是 只插入第一条记录  求解答 

---