Sorting and Filtering Data Using a Data View

Sort data in a DataView by setting the DataView.Sort property to the column name you want to sort on. To sort on multiple columns, separate column names with a comma (,). Complete the Sort expression with ASC to sort in ascending order, or DESC to sort in descending order. (ASC is the default behavior.)

The following code sample sorts the DataView in descending order on the Contact-Name column:

CustomersDataView.Sort = "ContactName DESC" // C#

CustomersDataView.Sort = "ContactName DESC";

0 0

Post a comment