We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataControl Background row

Hello,

I have implemented this code to set Background row in function of a row value:

void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.Cell.RowIndex > 0 && e.Cell.RowIndex < model.RowCount - Grid.TableSummaryRows.Count)
{
DataRow Fila = null;
Fila = ((DataRowView)model.Table.GetRecordFromRow(e.Cell.RowIndex)).Row;

if ((int)Fila["Value"] == 1)
{
e.Style.Background = Brushes.LightCoral;
}
else if ((int)Fila["Value"] == 2)
{
e.Style.Background = Brushes.LightCyan;
}
}
}

But, this doesn't work when there are grouping columns. How to modify the code to do that code works with grouping columns too?

Thanks.



1 Reply

MK Mayavel K Syncfusion Team March 31, 2011 02:01 PM UTC

Hi Jorge,

We have attached the sample that helps you achieve your requirement.

Please check the sample and let us know if you need any further assistance on this.

Regards,
Mayavel K



CopyPasteTest1_cb97820f.zip

Loader.
Live Chat Icon For mobile
Up arrow icon