protected void Page_Load(object sender, EventArgs e) { //从查询字符串中读取需要删除的id值 int id = int.Parse(Request.QueryString["id"]); if (!IsPostBack) { //根据传入的action值判断需要进行的操作 switch (Request.QueryString["action"].ToString().Trim()) { case "DelStudent": //删除个人信息 SDM.BLL.GerenInfo bllStudent = new SDM.BLL.GerenInfo(); bllStudent.Delete(id); SDM.DAL.ShowInfo.AlertAndRedirect("删除成功!", "GerenInfo.aspx", this.Page); break; case "DelAdmin": //删除管理员帐号 SDM.BLL.AdminInfo bllAdminInfo = new SDM.BLL.AdminInfo(); bllAdminInfo.Delete(id); SDM.DAL.ShowInfo.AlertAndRedirect("删除成功!", "AdminInfo.aspx?action=add", this.Page); break; case "DelJia": //删除管理员帐号 SDM.BLL.jiating bllJiaInfo = new SDM.BLL.jiating(); bllJiaInfo.Delete(id); SDM.DAL.ShowInfo.AlertAndRedirect("删除成功!", "JT1.aspx?action=add", this.Page); break; } } }
protected void btnDelete_Click(object sender, EventArgs e) { for (int i = 0; i <= gdvWishList.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)gdvWishList.Rows[i].FindControl("ChkSelected"); if (cbox.Checked == true) { bll.Delete(Convert.ToInt32(gdvWishList.DataKeys[i].Value)); } } LoadData(); this.CheckBox1.Checked = false; }