October 2010
Intermediate to advanced
1920 pages
73h 55m
English
You can sort the rows rendered by a GridView control by enabling the AllowSorting property. For example, the page in Listing 11.5 illustrates how you can sort the contents of the Movies database table.
Listing 11.5. SortGrid.aspx

When AllowSorting has the value True, column headers render as links. When you click a column header, you can sort the rows contained in the GridView in the order of the selected column.
When using explicitly specified fields with a GridView, such as BoundFields, you need to specify values for the fields’ SortExpression properties. Otherwise, nothing happens when you click a header.
The GridView ...