AD
Administrator
Syncfusion Team
December 22, 2006 11:06 AM UTC
Hi Ubaid,
To set cell specific properties in a GridDataBoundGrid, you must catch the PrepareViewStyleInfo event (or Model.QueryCellInfo event). In your handler, you check e.RowIndex and e.ColIndex, and if these point to the cell you want to change, you set e.Style.BackColor to the value you want. Below is a code snippet to change backcolor to Color.Red when the Text having the number greater than 25.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if( e.Style.Text != null && e.Style.Text != string.Empty
&& e.Style.CellValueType == typeof(int))
{
int number = int.Parse(e.Style.Text);
if( number > 25)
e.Style.BackColor = Color.AliceBlue ;
}
}
Best Regards,
Haneef