GridView Data Sorting in C#
The Kettic GridView .NET component provides a SortDescriptors property for users to set the grid data sorting function. This property is at the level of GridViewTemplate that is exposed in KetticGridView C# class for MasterTemplate instance. The descriptors for sorting allow users to create grid data sorting property and grid data sorting direction. The descriptor is a collection so that users just need perform the delete or clear operation. The collection is able to sort grid data of the descriptor that has been newly added.
How to Create Data Sorting to GridView
The sorting functionality can be enabled through the SortDescriptor property. We need change the value of the EnableSorting property of the desired template to True. The simple C# code below demonstrates how to achieve this.
And then, we can create and add new SortDescriptor to the collection to create grid data sorting for GridView. In the C# code below, we are going to use the PropertyName and the SortDirection properties. The PropertyName property will determine the sorting of grid data and the SortDirection property will control the sort direction.
How to Sort Grid Data by Multiple Columns
The Kettic DataGridView component is capable of sorting grid data not only by one column, but also multiple columns. The C# code below shows how to sort grid data by two columns to GridView. In the example below, the GridView will sort the ProductName column first as this sort expressions are added first, and then sort all groups based on the Price.
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