ASP 101 - Active Server Pages 101 - Web04
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

ASP.NET version of "Database Sort"

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".

Here's a zip file of the code (1.3 KB).

Play with the running version.

View the live source code.

Back to the "Database Sort" sample


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers