# Sorting

## Content



**FlexGrid** control by default lets you to **sort** by any column. The user simply has to click on the header of a column to toggle between the sorting states, ascending and descending.

If a user clicks the column header, it sorts by that column. In this case, the column header shows an upward pointing arrow indicating ascending order. Likewise, if a user clicks the column header once more, that is, the second time, the column sorts in descending order, with the arrow pointing downwards.

The snapshot below depicts sorting feature by the "Description" and "UnitPrice" columns:

![A snapshot of flexgrid application with data, showing two highlighted columns in ascending and descending orders.](https://cdn.mescius.io/document-site-files/images/3ca88af8-b501-48d7-a446-601c9251a2fb/images/column-sorting.png)

The user can also choose to set the [AllowSorting](/componentone/api/wpf/online-flexgrid/dotnet-framework-api/C1.WPF.FlexGrid.4.6.2/C1.WPF.FlexGrid.C1FlexGrid.AllowSorting.html) property in [C1FlexGrid](/componentone/api/wpf/online-flexgrid/dotnet-framework-api/C1.WPF.FlexGrid.4.6.2/C1.WPF.FlexGrid.C1FlexGrid.html) class or [AllowSorting](/componentone/api/wpf/online-flexgrid/dotnet-framework-api/C1.WPF.FlexGrid.4.6.2/C1.WPF.FlexGrid.Column.AllowSorting.html) property in the [Column](/componentone/api/wpf/online-flexgrid/dotnet-framework-api/C1.WPF.FlexGrid.4.6.2/C1.WPF.FlexGrid.Column.html) class to 'false' to prevent sorting in the entire FlexGrid control or a desired column within the control.