protected void chkActive_CheckChanged(object sender, EventArgs e) { CheckBox chkActive = (CheckBox)sender; GridViewRow row = (GridViewRow)chkActive.NamingContainer; ProductBL productBL = new ProductBL(); productBL.SetActive(int.Parse(((Label)row.FindControl("lblProductID")).Text), bool.Parse(((CheckBox)row.FindControl("chkActive")).Checked.ToString())); }
protected void btnActivateAll_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.SetActive(int.Parse(((Label)dgvProducts.Rows[i].FindControl("lblProductID")).Text), true); } }