$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Windows Forms PivotGrid Control
Create interactive user interface of Pivot table, build summarizations and highlight specific data
Home > WinForms UI Controls > User Manual > Sort in PivotGrid in C#

PivotGrid Group Sorting in C#.NET

KetticPivotGrid control contains various sorting options, which are able to sort group descriptions in rows and columns. With the sorting functionality, the users are able to sort the groups in an ascend order and a descend order according to the names of the properties or the aggregated description in Pivot. The users of this control are able to set the sorting functionality on the ColumnGroupDescriptions or RowGroupDescriptions.

Group Sorting Description in KetticPivotGrid

The default setting of RowGroupDescriptions in KetticPivotGrid is ascending according to the names of the properties. The end users of your application are able to simply change the sorting of a row field by clicking on the element. Additionally, we can apply sorting to Pivot according to the PropertyAggregateDescription. It is easy to set the sorting order of any row group description in ascending or descending. However, KetticPivotGrid control can not apply sorting the AggregateDescriptions. It is possible to sort the columns or rows according to the values aggregated.

Apply Sorting to KetticPivotGrid

KetticPivotGrid control allows the users to apply the sorting both in C# code and at runtime. The following are the C# code sample that shows how to apply sorting according to different elements.
The following C# code snippet shows how to sort the header in ascending or descending order. To change the sorting order, we can use the SortOrder property.

PropertyGroupDescription propGroupDescription = (PropertyGroupDescription)this.ketticPivotGrid1.RowGroupDescriptions[0];
propGroupDescription.SortOrder = Kettic.Pivot.Core.SortOrder.Descending;
this.ketticPivotGrid1.ReloadData();

The following C# code snippet demonstrates how to sort the GrandTotals in ascending or descending order. To change the sorting order, we need to use the SortOrder property and GroupComparer property.

PropertyGroupDescription propGroupDescription = (PropertyGroupDescription)this.ketticPivotGrid1.RowGroupDescriptions[0];
propGroupDescription.SortOrder = Kettic.Pivot.Core.SortOrder.Descending;
propGroupDescription.GroupComparer = new GrandTotalComparer() { AggregateIndex = 0 };
this.ketticPivotGrid1.ReloadData();

Change KetticPivotGrid Sorting at Runtime

To change the sorting at runtime in C# template project, we shall use the KetticPivotFieldList of the Pivot component. When changing the sorting at runtime, we can click a Row Label field or a Column Label field, and then a popup containing various sorting options will be open. The users can modify the sorting by using the sorting options. To save the current sorting without changing the order, we can use the first two options.
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