Repeater 里面加个绑定CheckBox   而后
单位 批量删除的时候 public static string GetString(Repeater ControlsID)
    {
        string StrDelete = "";
        foreach (RepeaterItem i in ControlsID.Items)
        {
            if (((HtmlInputCheckBox)i.FindControl("CheckBoxSelect")).Checked)
            {
                StrDelete += ((HtmlInputCheckBox)i.FindControl("CheckBoxSelect")).Value + ",";
            }
        }
        StrDelete = StrDelete.TrimEnd(',');
        return StrDelete;
    }
返回唯一标识 ,直接就可以删除了。

解决方案 »

  1.   

    给checkbox 的id加上 name = ID id="ID<%#Eval("Id")%>" 并且赋值 value = "<%#Eval("Id")%>"
    后台删除按钮事件里写 
    delete 表 where id in ("+Request.Form["ID"]+")
      

  2.   

    按钮事件中:int count = 0;
            string ch = string.Empty;//存放选择的ID
            string jch = string.Empty;//截取后的ID
            foreach (RepeaterItem ri in rep1.Items)
            {
                CheckBox cb = ri.FindControl("chkb") as CheckBox;
                HiddenField hid = ri.FindControl("hidd") as HiddenField;
                if (cb.Checked == true)
                {
                    count++;
                    ch += hid.Value.ToString() + ",";
                    jch = ch.Substring(0, ch.LastIndexOf(','));
                }
            }
    if (count > 0)
            {
               //执行删除
            }
            if (count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('请选择数据行!');", true);
            }
      

  3.   

    遍历Repeater所有Item取得ID的列表(可以用JS,也可以后台写)
    然后就是一个Delete语句了,使用In就可以
      

  4.   

     protected void btnDel_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < reapter.Items.Count; i++)
            {
                CheckBox cbx = reapter.Items[i].FindControl("chkDel") as CheckBox;
                if (cbx.Checked)
                {
                    string sql = "delete " + 表名 + " where id = " + long.Parse(cbx.ToolTip);
                   
                    执行删除            }
            }
        }
    记得给chkDel 的属性 ToolTip = '<%# Eval("id") %>'
      

  5.   

    int count = 0;
            string ch = string.Empty;//存放选择的ID
            string jch = string.Empty;//截取后的ID
            foreach (RepeaterItem ri in repeater.Items)
            {
                CheckBox cb = ri.FindControl("chkDel") as CheckBox;
                HiddenField hid = ri.FindControl("hidhid") as HiddenField;
                if (cb.Checked == true)
                {
                    count++;
                    ch += hid.Value.ToString() + ",";
                    jch = ch.Substring(0, ch.LastIndexOf(','));
                }
            }
            if (count > 0)
            {
                string sql = "delete from FD_Movie where [id] in (" + Request.Form["id"] + ")";            if (DbHelper.GetInstance().ExecuteSql(sql))
                {
                    ShowSuccessMsg("成功", "listmovie.aspx");
                }
                else
                {
                    ShowSuccessMsg("失败", "listmovie.aspx");
                } 
            }
            if (count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('请选择数据行!');", true);
            }
        }语法错误 (操作符丢失) 在查询表达式 '[id] in ()' 中。
    调试的时候出现这个问题 到底是什么原因??????????
      

  6.   

    int count = 0; 
            string ch = string.Empty;//存放选择的ID 
            string jch = string.Empty;//截取后的ID 
            foreach (RepeaterItem ri in repeater.Items) 
            { 
                CheckBox cb = ri.FindControl("chkDel") as CheckBox; 
                HiddenField hid = ri.FindControl("hidhid") as HiddenField; 
                if (cb.Checked == true) 
                { 
                    count++; 
                    ch += hid.Value.ToString() + ","; 
                    jch = ch.Substring(0, ch.LastIndexOf(',')); 
                } 
            } 
            if (count > 0) 
            { 
                string sql = "delete from FD_Movie where [id] in (" + Request.Form["id"] + ")";             if (DbHelper.GetInstance().ExecuteSql(sql)) 
                { 
                    ShowSuccessMsg("成功", "listmovie.aspx"); 
                } 
                else 
                { 
                    ShowSuccessMsg("失败", "listmovie.aspx"); 
                } 
            } 
            if (count == 0) 
            { 
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('请选择数据行!');", true); 
            } 
        } 语法错误 (操作符丢失) 在查询表达式 '[id] in ()' 中。 
    调试的时候出现这个问题 到底是什么原因??????????