Hi,
I am trying to apply cell color depending to the text value of a cell in a row, but I does not works.
What I am doing wrong?
I am following the telerik example:
http://www.telerik.com/help/winforms/gridview-cells-formatting-cells.html
Here is my code that I invoke after pupulate data by a datasource binding list.
I am trying to apply cell color depending to the text value of a cell in a row, but I does not works.
What I am doing wrong?
I am following the telerik example:
http://www.telerik.com/help/winforms/gridview-cells-formatting-cells.html
Here is my code that I invoke after pupulate data by a datasource binding list.
private void RefreshColorsOfResultsInGrid(){ this.radGridViewControl.BeginInit(); foreach (GridViewRowInfo row in this.radGridViewControl.Rows) { GridViewCellInfo cell = row.Cells["ResultAsString"]; if ((cell.Value.ToString().ToUpper() == "NEW") || (cell.Value.ToString().ToUpper() == "NEW*")) { cell.Style.CustomizeFill = true; cell.Style.DrawFill = true; cell.Style.ForeColor = Color.Green; cell.Style.Font = new Font("Arial", 8, FontStyle.Bold); } else if ((cell.Value.ToString().ToUpper() == "OLD") || (cell.Value.ToString().ToUpper() == "OLD*") ) { cell.Style.CustomizeFill = true; cell.Style.DrawFill = true; cell.Style.ForeColor = Color.Red; cell.Style.Font = new Font("Arial", 8, FontStyle.Bold); } else { cell.Style.CustomizeFill = true; cell.Style.DrawFill = true; cell.Style.ForeColor = Color.Black; } } this.radGridViewControl.EndInit(); this.radGridViewControl.Refresh();}