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

GridGroupingControl and AllowSelection

I have a problem with GridGroupingControl. I have allowed „Row, Multiple, Shift“ selection in TableOptions and. I can select more rows but I don’t know how to get collection of all selected rows in my C# code. Can you help me ?

1 Reply

AD Administrator Syncfusion Team November 30, 2004 01:47 PM UTC

Hi Jaris, you need to loop through the TableModel.Selections.Ranges collection. Each GridRangeInfo will have a Top and Bottom row which indicates the rowindex. To get the record at that row you would then pass the row index into Element el = Table.DisplayElements[rowIndex]; To get the actual record call Record r = el.ParentRecord; Please note that there are a couple of limitations to the cell-based selection mechanism in 2.x. For example, the selections are not adjusted when you collapse or expand groups. With 3.x we have a new record based selection mechanism. Check out the sample \Syncfusion\Essential Suite\3.0.0.x\Windows\Grid.Windows\Samples\Grouping\MultipleRecordSelection That sample shows multiple record selection across nested tables and groups. Marked records will stay selected even if you change the sort order or grouping. You have the option to continue to use the cell based selection mechanism compatible with 2.x or to use the record-based selection mechanism. If you set TableOptions.AllowSelection = GridSelectionFlags.None and specify ListBoxSelectionMode then the new record based selection code will be used. Otherwise, of If you set TableOptions.AllowSelection then the old GridModel based selection code will be used. With the new mechanism you can interate through selected record with the Table.SelectedRecords collection. Stefan

Live Chat Icon For mobile
Up arrow icon