Cell background color in databound grid

Hello. Is there an easy way to directly set the background color of a cell in databound grid? For example, when the cell contains some specific value I would like to have its background painted with a specific color. Regards Christian

1 Reply

AD Administrator Syncfusion Team July 14, 2003 06:14 AM UTC

You can use PrepareViewStyleInfo...
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex > 0 && e.RowIndex > 0)
	{
		try
		{
			double dValue = double.Parse(e.Style.Text);
			if( dValue > 100 )
			{
        			e.Style.BackColor = Color.Red;
			}
		}
		catch { } //empty
	}
}

Loader.
Up arrow icon