//GridView控件RowDeleting事件
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string  userID = GridView1.DataKeys[e.RowIndex].Values[0].ToString(); //取出要删除记录的主键值
        Usersmr user   = new Usersmr();                                       //创建Usersmr类对象user

        if (user.DeleteByProc(userID))                                        //根据主键使用DeleteByProc方法删除用户
        {
            ajaxDialog.OpenDialogForPage(Page, "删除成功!");
        }
        else
        {
            ajaxDialog.OpenDialogForPage(Page, "删除失败!");
        }
        GridView1.EditIndex = -1;
        GridViewBind();//重新绑定数据
    }
 protected void ImageButtonDelete_Click(object sender, ImageClickEventArgs e)
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         bool isChecked = ((CheckBox)GridView1.Rows[i].FindControl("chkSelected")).Checked;
         if (isChecked)
         {
             string  userID = ((Label)GridView1.Rows[i].FindControl("Label1")).Text;
             Usersmr user   = new Usersmr(); //创建Usersmr类对象user
             if (user.DeleteByProc(userID))  //根据主键使用DeleteByProc方法删除用户
             {
                 Response.Write("<script language=javascript>alert('删除成功!');location='UserManage.aspx';</script>");
             }
             else
             {
                 Response.Write("<script language=javascript>alert('" + userID + "删除失败!');location='UserManage.aspx';</script>");
             }
         }
     }
     GridViewBind();
 }