System.Data Namespace DataView Class
Sets or retrieves the sorting order for data in a table.
Script |
DataView.Sort [ = strExpression ] |
strExpression |
A string containing the column name followed by ASC ( ascending ) or DESC ( descening ). |
The property is read/write with no default value.
Columns are sorted asending by default. Multiple columns can be separated by commas.
See the Expression property of DataColumn for more details on forming a Sort expression.
The following examples demonstrate using the Sort property to set the order of records in a DataView. In the first two, the sort order is set at design time, while in the last, the sort order is dynamically set at run time, based on user input.
DataView Members RowFilter Expression