I have loaded the data from database to datagridview and have two columns target value and volume where volume >target value that volume cell should be in green color and
foreach (DataGridViewRow row in dgvWebData.Rows)
{
if (Convert.ToString(row.Cells["IssuerName"].Value) != Convert.ToString(row.Cells["SearchTermUsed"].Value))
{
row.DefaultCellStyle.BackColor = Color.Yellow;
}
else
{
row.DefaultCellStyle.BackColor = Color.White;
}
}
This Perfectly worked for me . even if a row is changed, same event takes care.