How can I change the color of an entire row via code?
I tried
row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
row.DefaultCellStyle.BackColor = System.Drawing.Color.Red;
Neither seems to affect the row at all.
Hi Edmond,
WJ-9133 is fixed in the latest Wisej build (1.5.12)
Best regards
Frank
Please post a reproducible test case. It depends on when you set the style, the row you are referring to may not exist anymore.
Test case attached
Hi Edmond,
thanks for putting together that sample. It helped us to reproduce the problem.
It´s logged as WJ-9133 and a fix will be included in the next Wisej release.
Best regards
Frank
Hi there,
You’ll see the colour changes if you refresh the page.
There’s a workaround as follows:
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
byte j;
for(j=0;j<dataGridView1.ColumnCount;j++)
{
dataGridView1.Rows[e.RowIndex].Cells[j].Style.ForeColor = System.Drawing.Color.Red;
}
}
So far this fix seems to work.
Row color is not change for 1.5.16
foreach (DataGridViewRow row in dataGridView1.Rows)
if (Convert.ToString(row.Cells[1].Value) == “C”)
{
row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
}
else
{
row.DefaultCellStyle.BackColor = System.Drawing.Color.GreenYellow;
}
dataGridView1.Update();
Application.Update(this);
Please login first to submit.