in reply to Sorting a table

IMHO it's much easier to handle this sort of thing on the client side. There are a number of Javascript libraries that make automatically sorting your tables extremely easy, and as a bonus it doesn't require a roundtrip to your web server. I've heard good things about the Standardista library but I haven't tried it myself.