It is an optimization question. When the data is first loaded in the Grid with no sort, the order of the rows will be that of the dataset, which we could call the “natural” sort. Most often, the dataset is already sorted on the primary key, which is usually an ID. If you sort on a column other then the ID, the first sort will be ASC, and the duplicate rows will still be sorted on the “natural sort”. If you sort again, that is, having a DESC sort, ALL the rows will be inverted, and thus, on the duplicate rows, the “natural” sort will also be inverted, that is, DESC. This is done because the grid doesn’t have to sort again when going from ASC to DESC, it only has to invert the whole grid. One can also argue that it is the expected behavior, that when going from ASC to DESC, all rows should be inverted.
In you case, it happens that the natural sort is the same as the primary key, and that is why you see ID DESC.
If you want to keep ID ASC, a possible workaround would be to keep the ID column sorted ASC by code, with the help of the SortedColumnsChanged event on the GridControl. For example, once the grid as been sorted on the Surname DESC, you add a new sort on the ID, and make it ASC.
Imported from legacy forums. Posted by André (had 632 views)