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
close icon

How can I make some of the records in GridGrouping control to be non-selectable?

Hi,
How can I make some of the records in GridGrouping control to be non-selectable?

Thanks,
Sanath Vijayakumar

1 Reply

AD Administrator Syncfusion Team February 16, 2007 08:00 PM UTC

Hi Sanath,

You can do this by handling the SelectedRecordChanging event of the grid and set e.Cancel to true for specified records. Before handling this event, you can turn of the cell based selection using TableOptions.AllowSelection property to None. Andthen enable the record based selection using ListBoxSelectionMode property. Here is a code snippet.

this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.SelectedRecordsChanging +=new SelectedRecordsChangedEventHandler(gridGroupingControl1_SelectedRecordsChanging);

private void gridGroupingControl1_SelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
if( e.SelectedRecord != null && e.SelectedRecord.Record != null)
{
Record rec = e.SelectedRecord.Record;
int iIdValue = int.Parse(rec.GetValue("ID").ToString());
if( iIdValue % 2 == 0 )
e.Cancel = true;
}
}

Let me know if this helps.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon