//删除 protected void ibDel_ItemDeleting(object sender, EventArgs e) { try { int Id = Convert.ToInt32((sender as LinkButton).CommandArgument); UsersBLL.DeleteUsers(Id); Response.Write("<script>alert('删除成功!');window.location.replace('UsersManage.aspx');</script>"); } catch { Response.Write("<script>alert('删除失败!');</script>"); } }
//删除选中项 protected void BtnAllDel_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(HSelectID.Value.Trim())) { try { string a = HSelectID.Value.Trim(); string[] b = a.Split(new char[] { ',' }); int i = 0; foreach (string c in b) { i++; UsersBLL.DeleteUsers(Convert.ToInt32(c)); } this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('已成功删除" + i + "条!');window.location.replace('UsersManage.aspx');</script>"); return; } catch { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败,请与技术人员联系!');</script>"); return; } } }