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

change the backcolor of a row in runtime

hi all.
how can i change the backcolor of a row, in run time? (let's say the third row)

3 Replies

AD Administrator Syncfusion Team February 8, 2007 05:37 PM UTC

Hi Shachar,

Do you want to change the selection backcolor depends on the record index? If yes, you should turn off the ListBoxSelectionColorOptions to None and handle the QueryCellInfo event of the grid to set the backcolor of the cell using e.Style.BackColor property. Here is a minimal sample that shows you "How to set the selection back color of record depends on the record rowindex?".

Sample : GGC_SummaryRow_Custom.zip

Best regards,
Haneef


SS Shachar Shimshon February 9, 2007 12:13 PM UTC

no, i want to change the backcolor of some row, not the selected row.

>Hi Shachar,

Do you want to change the selection backcolor depends on the record index? If yes, you should turn off the ListBoxSelectionColorOptions to None and handle the QueryCellInfo event of the grid to set the backcolor of the cell using e.Style.BackColor property. Here is a minimal sample that shows you "How to set the selection back color of record depends on the record rowindex?".

Sample : GGC_SummaryRow_Custom.zip

Best regards,
Haneef


AD Administrator Syncfusion Team February 9, 2007 07:38 PM UTC

Hi Shachar,

To set style property for a particular row, you would either add a ConditionalFormat or handle QueryCellStyleInfo:

1) If you want to set style property for a row, then you can add a conditional format to the grid.TableDescriptor.ConditionaFormats collection. Please refer this sample: C:\Program Files\Syncfusion\Essential Studio\4.x\windows\Grid.Grouping.Windows\Samples\ConditionalFormatting

Here is a forum thread with another sample.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=11621


2) You can use QueryCellStyleInfo event and provide the style setting on demand there. This is useful when you want to use a particular style setting for some arbitary row in the grouping grid. Please refer to the attached sample for implementation.

Sample : GGC_RecordColor.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon