How to prevent selection of a record when the row is disabled in the ggc

I am trying to use the SelectedRecordsChanging event to prevent the selection of a record the the row for that record in the ggc is disabled using the Conditional Format below..

GridConditionalFormatDescriptor gcfd = new GridConditionalFormatDescriptor("DisabledRow");
gcfd.Appearance.AnyRecordFieldCell.BackColor = Color.Lavender;
gcfd.Appearance.AnyRecordFieldCell.Enabled = false;


How can I determine if a row is disabled from this event?

1 Reply

AD Administrator Syncfusion Team March 14, 2007 03:05 PM UTC

Hi James,

Please try this code snippet.

void gridGroupingControl1_SelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
if (e.SelectedRecord != null && e.SelectedRecord.Record != null)
{
GridTable table = e.Table as GridTable;
e.Cancel = !table.GetTableCellStyle(e.SelectedRecord.Record, "ColumnName").Enabled;
}
}

Best regards,
Haneef

Loader.
Up arrow icon