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



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
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


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

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