protected void btnDelete_Click(object sender, EventArgs e) { if (dealerBiz == null) { dealerBiz = new DealerBiz(); } if (dealerBiz.DeleteDealer(DealerID)) { Response.Redirect("dealer.aspx"); } }
protected void btnDelete_Click(object sender, EventArgs e) { try { dealerBiz = new DealerBiz(); foreach (GridViewRow row in gvDealer.Rows) { var cbDealer = row.FindControl("cbDealer") as CheckBox; var hfDealerId = row.FindControl("hfDealerId") as HiddenField; bool isChecked = cbDealer.Checked; if (isChecked) { dealerBiz.DeleteDealer(hfDealerId.Value); } } BindGrid(); } catch (Exception ex) { ProcessException(ex); } }