protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LiuYanDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { string DeleteTitle = ""; foreach (GridViewRow gr in this.GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[1].FindControl("Select"); if (cb.Checked) { //删除数据库信息 Label ll = (Label)gr.Cells[1].FindControl("lblLiuYanID"); int LiuYanID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); DeleteTitle += bll_LiuYan.GetModel(LiuYanID).MainInfo + ","; bll_LiuYan.Delete(LiuYanID); } } LogManage.WriteLog(Request.UserHostAddress, "留言管理", "删除留言", "成功", "留言主题:" + DeleteTitle.TrimEnd(',') + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); ShowData(); } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LiuYanDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblLiuYanID"); int LiuYanID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_LiuYan bll_LiuYan = new WebProject.BLL.BaseData.ZT_COM_LiuYan(); LogManage.WriteLog(Request.UserHostAddress, "留言管理", "删除留言", "成功", "留言主题:" + bll_LiuYan.GetModel(LiuYanID).MainInfo + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); bll_LiuYan.Delete(LiuYanID); //重新加载信息 ShowData(); } } }