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

Please visit our partners

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

Script Output:
id last_name Down Arrow ↓  first_name sales
23 Zimmerman Walter 4980
22 Youngs Quincy 4420
26 Xavier Simon 5580
27 White Mark 4500
24 Valentino Linda 2965
25 Underwood Debra 3790
17 Thompson Vincent 4820
12 Steel Tammy 3570
20 Smith Fred 6370
8 Richards Kate 4260
19 Quinn Howard 5865
4 Peacock Margaret 4685
18 Ostrander Ian 3965
14 Nelson Beth 4345
11 Miller Greg 5640
2 Leverling Janet 6250
5 King Robert 5290
9 Jones Edward 3450
21 Ingraham Owen 4750
15 Hopkins Peter 6710
16 Graham Chris 4050
1 Fuller Andrew 5000
7 Edwards Frank 3840
13 Dodsworth Nancy 2750
10 Callahan Laura 3675
3 Buchanan Steven 3245
6 Andersen David 6420

ASP HTML Download            FAQ

ASP.NET Version

I can't take credit for this one... one of our readers actually sent me an email with some ideas to modify our original Database Sort sample. Here's a excerpt from that email:

Rather than have two links, '+' and '-', you can remember the current state in a variable and simply toggle between the two by clicking the field name itself. Or, as I've done here, provide feedback as to the order by using arrows.

The code that was sent worked fine, but was a little complex and was obviously taken from a highly modified version. I've simplified things a bit and incorporated both suggestions: the simpler UI (just clicking on the field name) and the indicator arrows.

The simplified UI means that you no longer have to figure out if you should click the + or the - next to each field name. Instead, you simply click on the field name itself. The first click sorts ascendingly by the field clicked. Once the table is sorted by the desired field, simply click the field name again to reverse the order.

The current sort order is indicated by an arrow next to the field that the table is currently sorted by. I've included both a text-based arrow and an image-based one... you'd probably use only one or the other. I only include them both for illustration. The images are something I just whipped up. I wanted them to stand out which is the excuse I'll use for making them red. You'll probably want to use your own images, but if you do want a copy of ours for any reason they can be found here:

I also made slightly subtler ones just in case bright red isn't your thing:


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