How can I set a colored cell value on a grid when the cell value has changed(e.g. blue) and when the cell value is new (e.g. green)?
Is it possible to detect if a new value is changed back to the original (and restore the color to black)?
ADAdministrator Syncfusion Team August 19, 2004 05:58 AM
You will have to do this yourself.
The grid does not normally cache any cell values other than the current value saved in the grid cell. So, if you want to know the if values are changed or new or ???, you will have to cache these values somehow tracking things yourself.
You can handle the SaveCellInfo event, and in that event use e.RowIndex, e.COlIndex, e.Style.CellValue (new value), and grid[e.RowIndex, e.ColIndex].CellValue (oldValue) to set up your cache of changed values.
You could subscribe to the PrepareViewStyleInfo event and if e.RowIndex, e.ColIndex point to a row/col in your cache, you would set e.Style.BackColor accordingly.
Now if you grid supports moving rows/column, this complicates things a little. In that case, instead of using a separate cache to save the changes, you may want to put a custom object in e.Style.Tag in SaveCellInfo that holds the information about the changes. This way, when the rows/cols move, the information moves with them.
The above assumes you are using aGridControl to hold the data. If you are using a virtual grid or a GridDataBoundGrid, then you would have to use a separate cache to save information as these grids do not store anything in their data object.