Controls You Can Use on Web Forms ASP.NET Data Controls GridView Control
The GridView control provides a default sorting functionality without requiring any coding. If the default sort behavior is not adequate for the need, though, the GridView provides for customization of the default sort functionality.
With the default setting, all columns in the grid are sortable. The headers for all columns are automatically rendered as LinkButton controls, that users can click to arrange the ordering of the grid contents by that column.
- Set the GridView control’s AllowSorting property.
<asp:GridView id="myGrid" runat="server"
datasourceid="customers"
allowsorting=true
...
>
or simply
<asp:GridView id="myGrid" runat="server"
datasourceid="customers"
allowsorting
...
>