$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
GridView Control for Windows Forms
Set data grouping in grid by using DataGridView component in Windows Forms applications
Home > WinForms UI Controls > User Manual > Setting to Grid Grouping in C#

Set Grid Data Grouping in C#

The Kettic GridView .NET component provides a GroupDescriptors property for users to set the grid data grouping feature. This property is exposed in KetticGridView C# class for MasterTemplate instance. The grouping descriptor is a collection used to set the grouping criteria and direction to grid data that is bound to GridView C#.NET component, so that users just need perform the delete or clear operation. When we add a new descriptor to the collection, the current view can show the sorted items in groups.

How to Create Data Grouping to GridView

The grouping functionality can be enabled through the SortDescriptor property. We need change the value of the EnableGrouping property of the desired template to True. The simple C# code below demonstrates how to achieve this.

this.ketticGridView1.MasterTemplate.EnableGrouping = true;
And then, we can create and add new GroupDescriptor to the collection to create grid data grouping to GridView. In the C# code below, we are going to use the GroupName property, which determine the grouping of grid data and the group names for one grouping criteria to grid data.

GroupDescriptor descriptor = new GroupDescriptor();
descriptor.GroupNames.Add("Product", ListSortDirection.Descending);
this.ketticGridView1.GroupDescriptors.Add(descriptor);

How to Group Grid Data by Multiple Columns

The Kettic DataGridView component is capable of grouping grid data not only by a single column names, but also multiple column names. The C# code below shows how to group grid data by two column names to GridView.

GroupDescriptor descriptor1 = new GroupDescriptor();
descriptor1.GroupNames.Add("Product", ListSortDirection.Descending);
descriptor1.GroupNames.Add("ProductName", ListSortDirection.Ascending);
this.ketticGridView1.GroupDescriptors.Add(descriptor1);

How to Group Grid Data by Multiple Levels

The Kettic DataGridView component is capable of grouping grid data by multiple levels. The C# code below shows how to group more than one levels

GroupDescriptor descriptor2 = new GroupDescriptor();
descriptor2.GroupNames.Add("Product", ListSortDirection.Ascending);
GroupDescriptor descriptor3 = new GroupDescriptor();
descriptor3.GroupNames.Add("ProductName", ListSortDirection.Ascending);
this.ketticGridView1.GroupDescriptors.Add(descriptor2);
this.ketticGridView1.GroupDescriptors.Add(descriptor3);

UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls