Tuesday, December 12, 2006

Tia Williams Asks "How do you dynamically sort a record set displayed in a HTML table structure on a classic ASP page?"

It depends on the size of the data. If it is small, you could move the data back and forth and sort from memory.

If it's large, I usually just requery the database with the appropriate ORDER BY clause.

If you want to sort it strictly on the client side (good for small to medium amounts of data) there are a number of javascript solutions which will take care of the problem for you.

For instance:
http://kryogenix.org/code/browser/sorttable/
http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting
http://www.codeproject.com/jscript/sorttable.asp