Hello
I'm using CellFormatting event to color some cells in my RadGridView. On Form_Load it works fine (see first image). But when I sort the RadGridView it messes the whole thing up (see second image). You can see my code here:
if (e.Column.Name == "va" && e.CellElement.Value != null)
{
if ((e.CellElement.Value.ToString() == "P" && e.Row.Cells["id"].Value.ToString() == "1") ||
(e.CellElement.Value.ToString() == "A" && e.Row.Cells["id"].Value.ToString() == "1") ||
(e.CellElement.Value.ToString() == "E" && e.Row.Cells["id"].Value.ToString() == "1"))
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.Red;
e.CellElement.NumberOfColors = 1;
}
else if (e.CellElement.Value.ToString() == "P" || e.CellElement.Value.ToString() == "A" || e.CellElement.Value.ToString() == "E")
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.Orange;
e.CellElement.NumberOfColors = 1;
}
}
Any suggestions how to fix this?
Thanks in advance
I'm using CellFormatting event to color some cells in my RadGridView. On Form_Load it works fine (see first image). But when I sort the RadGridView it messes the whole thing up (see second image). You can see my code here:
if (e.Column.Name == "va" && e.CellElement.Value != null)
{
if ((e.CellElement.Value.ToString() == "P" && e.Row.Cells["id"].Value.ToString() == "1") ||
(e.CellElement.Value.ToString() == "A" && e.Row.Cells["id"].Value.ToString() == "1") ||
(e.CellElement.Value.ToString() == "E" && e.Row.Cells["id"].Value.ToString() == "1"))
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.Red;
e.CellElement.NumberOfColors = 1;
}
else if (e.CellElement.Value.ToString() == "P" || e.CellElement.Value.ToString() == "A" || e.CellElement.Value.ToString() == "E")
{
e.CellElement.DrawFill = true;
e.CellElement.BackColor = Color.Orange;
e.CellElement.NumberOfColors = 1;
}
}
Any suggestions how to fix this?
Thanks in advance