Just as with classic ASP, there are often many different ways to accomplish something
using ASP.NET. When I first started writing this sample I started to use the built in
sorting support offered by the DataGrid control, but things quickly started getting complicated.
While the DataGrid's sorting can do lots of cool things, the original classic ASP sample
(whose functionality I was attempting to replicate) didn't do all that much... just a little
simple sorting. As a result, trying to replicate it exactly using the DataGrid's sorting
functionality was making things unnecessarily complex.
So... I scrapped the script and started
over. This time there would be no OnSortCommand, SortExpression, or storing of the previous sort
order via viewstate. Instead I borrowed from the original sample and just built some simple
hyperlinks into the table headers. The code may not really utilize the true power of ASP.NET or the
DataGrid, but in a lot of ways I think this way is better. It's simple and it gets the job done.
Sometimes it's just easier to go "old school".