/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; BProductCheckDetailBB productCheckDetailBB = new BProductCheckDetailBB(); try { //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); productCheckDetailBB.DeleteRecord(id); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { productCheckDetailBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
public bool DeleteProductCheckDetail(int id) { BProductCheckDetailBB productCheckDetailBB = new BProductCheckDetailBB(); try { return productCheckDetailBB.DeleteRecord(id); } finally { productCheckDetailBB.Dispose(); } }