protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { ProjectPaperEntity projectPaperEntity = new ProjectPaperEntity(); ProjectPaperBll projectPaperBll = new ProjectPaperBll(); Label label = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lbID"); int num = int.Parse(label.Text.ToString()); projectPaperEntity.PPID = num; if (projectPaperBll.Delete(projectPaperEntity)) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "msg", "alert('删除成功');", true); } else { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "msg", "alert('删除失败');", true); } this.LoadData(0, ""); return; }
protected void LinkButton1_Click(object sender, EventArgs e) { ProjectPaperEntity projectPaperEntity = new ProjectPaperEntity(); ProjectPaperBll projectPaperBll = new ProjectPaperBll(); for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox checkBox = (CheckBox)this.GridView1.Rows[i].FindControl("chkBox"); if (checkBox != null && checkBox.Checked) { Label label = (Label)this.GridView1.Rows[i].FindControl("lbID"); if (label != null) { projectPaperEntity.PPID = int.Parse(label.Text.ToString().Trim()); projectPaperBll.Delete(projectPaperEntity); } } } this.LoadData(0, ""); }