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\'";
this.gridGroupingControl1.TableDescriptor.ConditionalFormats.Add(descriptor1);
//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)
return;
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
Regards,
Amal Raj U.