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 get the selected elements in a groupingGrid when the groups are collapsed?

Thread ID:





46367 Jul 12,2006 01:27 AM Jul 12,2006 08:42 AM Windows Forms 1
Tags: GridControl
Prathima Venkobachar
Asked On July 12, 2006 01:27 AM

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.

Administrator [Syncfusion]
Replied On July 12, 2006 08:42 AM

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


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.