protected void btnDeleteAll_Click(object sender, EventArgs e) { ProductBL productBL = new ProductBL(); for (int i = 0; i < dgvProducts.Rows.Count; i++) { if (((CheckBox)dgvProducts.Rows[i].FindControl("chkSelect")).Checked) { productBL.DeleteProduct(int.Parse(((Label)dgvProducts.Rows[i].FindControl("lblProductID")).Text)); } } }
protected void dgvProducts_RowDeleting(object sender, GridViewDeleteEventArgs e) { ProductBL productBL = new ProductBL(); productBL.DeleteProduct(int.Parse(dgvProducts.DataKeys[e.RowIndex].Values[0].ToString())); Page.Response.Redirect("/administrator/products.aspx"); }