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

How can I get the selected elements in a groupingGrid when the groups are collapsed?

Hi, I have a grid grouping control that displays records under multiple groups. When I select one or more records under a group, collapse all the groups and try to retrieve the selected elements, using the property table.DisplayElements or table.Elements its throwing exception. How can I get the selected elements even when the groups are collapsed? Here is the code segment I am using to retrieve selected records, Table table = grid.Table; foreach (GridRangeInfo range in grid.TableControl.Selections.Ranges) { if (range.IsRows) { for(int i = range.Top; i <= range.Bottom; ++i) { Element el = table.DisplayElements[i]; Record r = el.GetRecord(); if (r!=null) { object val = r.GetValue( "Column_Name" ) } } } } Regards, Prathima.

1 Reply

AD Administrator Syncfusion Team July 12, 2006 12:42 PM UTC

If you are using the support in GridGroupingControl for record selections (as opposed to using the selection support inherited from GridControlBase which has no knowlegde of the grouping architecture), then you access the selected records directly from the grid.Table.SelectRecords collection. Here is a little sample showing the 2 properties you need to set to activate the record selection support, and button handler code showing how to get at the selected records. There is a little problem in that by default, these record selections are cleared when you click a +/- cell. If you do not want this, then you can handle a couple of events to avoid it. The sample does this. http://www.syncfusion.com/Support/user/uploads/WindowsApplication17_25d9f93b.zip

Loader.
Live Chat Icon For mobile
Up arrow icon