Hi Rekha,
Thanks for using Syncfusion products.
To apply styles to the Grid cells we have to use QueryCellStyleInfo event. Please refer the
below code snippet which illustrates how to compare two cell values of the same row and
apply styles to the cells depending on the comparision:
protected void GridGroupingControl1_QueryCellStyleInfo(object sender,
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if ((e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell ||
e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell))
{
if (e.Style.TableCellIdentity.RowIndex ==5)
{
if (e.TableCellIdentity.Column.Name == "Numbers1")
{
val1 = (System.Int32)e.Style.CellValue;
}
if (e.TableCellIdentity.Column.Name == "Numbers2")
{
val2 = (System.Int32)e.Style.CellValue;
}
if ((val2 < val1) && (e.TableCellIdentity.Column.Name == "Numbers2") &&
(e.Style.CellValue.ToString() == val2.ToString()))
e.Style.BackColor = System.Drawing.Color.Blue;
else if ((e.TableCellIdentity.Column.Name == "Numbers1") &&
(e.Style.CellValue.ToString() == val1.ToString()))
e.Style.BackColor = System.Drawing.Color.Orange;
}
}
}
Please have a look at the sample from the below link which illustrates the above:
http://websamples.syncfusion.com/samples/Grid.Web/5.1.0.51/I38963/main.htmPlease let me know if you have any other queries.
Regards,
Raji