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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

56566 Feb 16,2007 11:58 AM Feb 16,2007 03:00 PM Windows Forms 1
loading
Tags: Grouping
Sanath Vijayakumar
Asked On February 16, 2007 11:58 AM

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

Thanks,
Sanath Vijayakumar

Administrator [Syncfusion]
Replied On February 16, 2007 03:00 PM

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

CONFIRMATION

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.

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.

;