title: DataGridView row's background color is not changing
body: <p>I want to change the background color of the DGV's row based on particular condition at load even in Windows Form. But I can't see any change of color to any DGV's row. Could anyone tell me how can I solve this problem?</p>
  
  <pre><code>private void frmSecondaryPumps_Load(object sender, EventArgs e)
  {
              try
              {
                  DataTable dt = DeviceData.BindData("SECONDARY_PUMPS".ToUpper());
                  dataGridView1.DataSource = dt;
  
                  foreach (DataGridViewRow row in dataGridView1.Rows)
                  {
                      foreach (DataGridViewColumn column in dataGridView1.Columns)
                      {
                          if (row.Cells[column.Name] != null)
                          {
                              if (row.Cells[column.Name].Value.ToString() == "ON")
                                  row.DefaultCellStyle.BackColor = System.Drawing.Color.Green;
  
                              if (row.Cells[column.Name].Value.ToString() == "OFF")
                                  row.DefaultCellStyle.BackColor = System.Drawing.Color.Red;
                          }
                      }
                  }
  
                  dataGridView1.Refresh();
              }
              catch (Exception err)
              {
                  MessageBox.Show(err.Message);
              }
          }
  </code></pre>