I have a similar question to a previous one. I need to change the backgroud color of a sinlge cell in a GridDataBoundGrid, based on the most recent value of that cell's contents. What's the most efficient way to do this?
ADAdministrator Syncfusion Team January 28, 2003 02:18 AM
Handle PrepareViewStyleInfo and getting the value to be tested from the passed-in style. In your handler, you would conditionally set e.Style.Color by testing the cell value (or cell text) based on whether the e.ColIndex and e.RowIndex pointed to your test cell.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
//test cell 1,4
if(e.ColIndex == 4 && e.RowIndex == 1)
//this assumes cell is an int
int cellValue = int.Parse(e.Style.Text);
if(cellValue > 10)
e.Style.BackColor = Color.Red;