Hi,
I have a problem when formatting the background color of a row and then sorting the grid view. I have a gridview with 10 columns. Depending on a condition I color the background on some rows. See code. This works initially fine. But when I now sort the grid view more and more rows are colored. If I click a lot of times on different column headers all rows execept one have a formatted background. I'm surely forgot something to do, to make this work.
Thanks for your help,
Michael
I have a problem when formatting the background color of a row and then sorting the grid view. I have a gridview with 10 columns. Depending on a condition I color the background on some rows. See code. This works initially fine. But when I now sort the grid view more and more rows are colored. If I click a lot of times on different column headers all rows execept one have a formatted background. I'm surely forgot something to do, to make this work.
private
void
RadGridView1CellFormatting(
object
sender, CellFormattingEventArgs e)
{
if
(!String.IsNullOrEmpty(e.CellElement.RowInfo.Cells[
"Bearbeitungsfrist"
].Value.ToString()))
{
var bfrist = (DateTime)e.Row.Cells[
"Bearbeitungsfrist"
].Value;
if
(bfrist < DateTime.Now)
{
e.CellElement.DrawFill =
true
;
e.CellElement.ForeColor = Color.White;
e.CellElement.NumberOfColors = 1;
e.CellElement.BackColor = Color.Coral;
}
}
}
Thanks for your help,
Michael