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

Different Selection Modes in a nested table

I have a five level nested table. I want the top three levels to only allow one row to be selected. I want the fourth level to allow multiple selections unless you select a row at the fifth level. If you select a row at the fifth level then I want the fourth level to only allow the related row to be selected. Ideally the parrent rows for any child select row would always be selected.

My question is can this be acheived through table options or do I have to trap the selection events and manually select and deselect to acheive the behaviour?


1 Reply

AD Administrator Syncfusion Team July 21, 2006 03:54 PM UTC

Hi Bill,

One way to achieve this behavior is to handle the Model.SelectionChanging event of the corresponding TableControl. Set the ListBoxSelectionMode to MultiExtended for the gridgroupingcontrol. Below is the code snippet.

this.gridGroupingControl1.GetTableControl("MyChildTable").Model.SelectionChanging += new Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventHandler(Model_SelectionChanging_MyChildTable);

In this event handler, you can check for the e.Reason and cancel it when it is MouseMove, so that more than one row can not be selected.

// Form_Load
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;

private void Model_SelectionChanging_MyChildTable(object sender, Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs e)
{
if(e.Reason == GridSelectionReason.MouseMove)
e.Cancel = true;
}

Please try this and let me know if this helps.
Regards,
Rajagopal

Loader.
Live Chat Icon For mobile
Up arrow icon