When GridView implements sorting, does it automatically append string values “ASC” or “DESC” to the value of sortExpression parameter? If so, then based on what criteria does it “decide” when to append “ASC” and when to append “DESC” value?
views:
297answers:
1Does GridView automatically append values “ASC” or “DESC” to the value of sortExpression parameter?
Yes, it does. Clicking the same column multiple times in a row toggles the sort between ASC and DESC. See MSDN for more info.
Clicking the link button for a column causes the items in the GridView control to be sorted based on the sort expression. Typically, the sort expression is simply the name of the field displayed in the column, which causes the GridView control to sort with respect to that column. To sort by multiple fields, use a sort expression that contains a comma-separated list of field names. You can determine the sort expression that the GridView control is applying by using the SortExpression property. Clicking a column's link button repeatedly toggles the sort direction between ascending and descending order. To determine the current sort direction, use the SortDirection property.