//删除 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); //删除产品 int res = EispProBLL.DeletePro(id); // Page.ClientScript.RegisterStartupScript(this.GetType(), "", "javascript:return confirm('删除后无法恢复!请确认!');", true); if (res > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!');", true); if (EispProBLL.GetRecordCount() > 0) { AspNetPager1.Visible = true; AspNetPager1.RecordCount = EispProBLL.GetRecordCount(); ProductBind(AspNetPager1.RecordCount, AspNetPager1.PageSize); } else { this.GridView1.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (EispProBLL.GetRecordCount() > 0) { AspNetPager1.RecordCount = EispProBLL.GetRecordCount(); ProductBind(AspNetPager1.RecordCount, AspNetPager1.PageSize); BindDrpClass(0, "-"); } } }
protected void btnDelete_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { if (((CheckBox)row.FindControl("chk")).Checked) { int id = int.Parse(((Label)row.FindControl("id")).Text); // this.News_Delete(id); EispProBLL.DeletePro(id);//删除产品 } AspNetPager1.Visible = true; } if (EispProBLL.GetRecordCount() > 0) { AspNetPager1.RecordCount = EispProBLL.GetRecordCount(); ProductBind(AspNetPager1.RecordCount, AspNetPager1.PageSize); } else { this.GridView1.Visible = false; } }