码迷,mamicode.com
首页 > 其他好文 > 详细

点击repeater的一个修改事件触发全部repeater每一行的修改事件

时间:2015-03-06 18:40:55      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:

<td align="center">
                            <asp:LinkButton ID ="btnvip" runat ="server" CommandArgument=‘<%#Eval("id") %>‘ CommandName="edit" Text ="修改"></asp:LinkButton>
                        </td>
                         <td align="center">
                                <asp:HiddenField ID="hf" runat="server" Value=‘<%#Eval("Id") %>‘/>
                            </td>
             </tr>

protected void repeater1_bind(object source, RepeaterCommandEventArgs e)
 {

      if (e.CommandName.Equals("edit"))
        {
            for (int i = 0; i < rptlist.Items.Count; i++)
            {
                TextBox txtcom = (TextBox)rptlist.Items[i].FindControl("tbvip");
                HiddenField hf = (HiddenField)rptlist.Items[i].FindControl("hf");
                int id = int.Parse(hf.Value);
                if (txtcom.Text.ToString() != "" && txtcom.Text.ToString() != null)
                {
                    DataTable dtvip = DB.GetDataTable("businessid,busoname,businessname", "business", "businessname=‘" + txtcom.Text.Trim() + "‘", "");
                    DB.Operate("update table  set cmId=‘" + dtvip.Rows[0][0].ToString() + "‘,Cname=‘" + dtvip.Rows[0][1].ToString() + "‘where id=‘" + id + "‘");
                }

            }
            Display();
        }

}

点击repeater的一个修改事件触发全部repeater每一行的修改事件

标签:

原文地址:http://www.cnblogs.com/candyzhmm/p/4318889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!