set cell background color

Hi,

I'm trying to figure out if you are able to change the background of a cell when the value of a different cell changes.
For example, within the same row, if the value of the first cell changes, I want to set the background of another cell down the row to another color.

Any help would be appreciated.

Thanks,
Linda

1 Reply

AD Administrator Syncfusion Team November 17, 2006 04:39 AM UTC

Hi Linda,

Are you using GridDataBoundGrid? If so, please refer the below forum thread which discuss with simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=48794

For GridControl, you can handle the CurrentCellChanging event and set the backcolor property of the cell using grid's indexer. Here is a code snippet to show this.

//Column 1 changes affect the Column 3
private void GridCellChanging(Object sender, CancelEventArgs e)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( cc.ColIndex == 1)
grid[cc.RowIndex, 3].BackColor = Color.Blue;
}

Best Regards,
Haneef

Loader.
Up arrow icon