This is a migrated thread and some comments may be shown as answers.

Grouping by Related ID

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 03 May 2012, 07:22 PM
I have an OpenAccess ORM context that is setting the data source on a RadGridView. I have tried creating a group descriptor that would access the primary id of a related table (ex. dataItem.ProductVersion.ProductID). The column populates with data fine, however the grouping never occurs. I have attempted to set the grouping at design time, and programmatically. I have also attempted to convert the object into an anonymous object, and get the same effect. I can drag that group to the grouping panel and the data will group correctly, but how do I get this to happen without user interaction?

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 08 May 2012, 02:42 PM
Hi Nick,

Thank you for writing.

You must create and add a GroupDescriptor with a PropertyName that is equal to the Column.Name of the column which you want to group by. Here is a sample example with a column named "Column1":
GroupDescriptor groupDescriptor = new GroupDescriptor();
groupDescriptor.GroupNames.Add("Column1", System.ComponentModel.ListSortDirection.Ascending);
gridView.GroupDescriptors.Add(groupDescriptor);

More information regarding the grouping capabilities of RadGridView can be found in the following help section: http://www.telerik.com/help/winforms/gridview-grouping-setting-groups-programmatically.html.

I hope this helps.

Regards,
Julian Benkov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Nick
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or