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(); }
//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();//���°����� }