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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Highlight a row based on record value from hidden column

Thread ID:





127273 Nov 7,2016 10:31 PM UTC Nov 8,2016 01:48 PM UTC WinForms 1
Tags: GridGroupingControl
Asked On November 7, 2016 10:31 PM UTC


I have a gridgrouping control databound to a datatable in dataset. I have a hidden column (removed it from visible columns). I would like to highlight the row in the grid based on value in the hidden column. Please let me know which event to handle for this. The row should be highlighted using backcolor irrespective of whether user clicked on it or not. Please clarify this.


Amal Raj Umapathy Selvam [Syncfusion]
Replied On November 8, 2016 01:48 PM UTC

Hi Devi, 

Thanks for using Syncfusion products. 

The reported scenario of highlighting the row based on hidden columns cell value can be done using Conditional Formatting. By default when condition formatting are enabled,  the SelectionBackColor  will override the highlighted record’s BackColor, this can be resolved by using TableControlDrawCellDisplayText event. Please make use of the below code, 
Code Snippet 
//Conditional Formatting. 
GridConditionalFormatDescriptor descriptor1 = new GridConditionalFormatDescriptor(); 
descriptor1.Appearance.AnyRecordFieldCell.BackColor = Color.Green; 
descriptor1.Expression = "[ContactTitle] = \'Sales Manager\'"
//Event Subscription. 
this.gridGroupingControl1.TableControlDrawCellDisplayText += new GridTableControlDrawCellDisplayTextEventHandler(gridGroupingControl1_TableControlDrawCellDisplayText); 
void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e) 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    if (style == null || style.TableCellIdentity == null || style.TableCellIdentity.Column == null  
        || style.TableCellIdentity.DisplayElement.GetRecord() == null
    if (style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell  
        || style.TableCellIdentity.TableCellType == GridTableCellType.AnyRecordFieldCell  
        || style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell) 
        Record record = style.TableCellIdentity.DisplayElement.GetRecord(); 
        if (descriptor1.CompareRecord(record) && record.IsCurrent) 
            Rectangle rectangle = e.Inner.ClipBounds; 
            rectangle.Height += 4; 
            rectangle.Width += 4; 
            e.Inner.Graphics.FillRectangle(new SolidBrush(Color.Green), rectangle); 
Sample Link 
Amal Raj U. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon