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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to iterate grouped values?

Thread ID:





32534 Aug 2,2005 11:33 PM UTC Aug 3,2005 07:46 PM UTC WinForms 2
Tags: Grouping
Sean Greer
Asked On August 2, 2005 11:33 PM UTC

I have these values in a DataTable: ZipCode City 93512 Bishop 93514 Bishop 93515 Bishop I initialize my Engine and Table like this: this.m_Engine = new Engine(); this.m_Engine.SetSourceList(this.ZipTable.DefaultView); this.m_Engine.RecordAsDisplayElements = true; this.m_Table = this.m_Engine.Table; I then want to change the grouping to be by city, so I do this: this.m_Table.TableDescriptor.GroupedColumns.Add("City"); I now want to iterate the Records (or Elements?) and have it return to me one row for each grouping level. What collection should I be accessing on the Table object to return that list? Thanks, Sean

Administrator [Syncfusion]
Replied On August 3, 2005 07:48 AM UTC

Under a group, there may be either records or sub-groups. So a group has two properties, group.Groups and group.Records. Only one of these collections is non-null. If the group.Records != null, then the group is showing records and you can iterate through group.Records. If the group.Records is null, then group.Groups should be not null, and you can iterate through that collection. The entries in group.Groups will be a Group object, and you can use their .Category property to see the grouped key.
Group g = this.gridGroupingControl1.Table.TopLevelGroup;
if(g.Records != null)
	//g.Records is populated
	//g.Groups is populated

Sean Greer
Replied On August 3, 2005 07:46 PM UTC

That was just what I needed. Thanks Clay.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon