Asp.net 4.0 gridView, built in support for "sorting arrows", saves some code. All of my grids are sorted by default when they are returned from the database, so it would be logical that I should indicate which column is sorted by default using ASP.NET SortedDescendingHeaderStyle-CssClass etc.
ASP.NET does not decorate the default sorted column magically: it does not know what order SQL indicates. I can declaratively or programmatically decorate the corresponding header cell with the correct CSS class ... but then ASP.NET does not delete it for me when I sort it. Therefore, I am currently shooting this by moving the header cells, looking for it in the first Sort event. So I have some code that I run twice, once to add an arrow, and once on the first manual sort to delete it. This complex, almost the same work as all the work was before 4.0.
So ... I have to miss something: is there a way to tell ASP.NET GridView that the content is already sorted in such a way that it doesnโt have to be added manually and then removed this sort indicator?
philw source share