Several Methods for sorting by clicking the header

Source: Internet
Author: User
I remember that people started discussing the issue of table sorting in the classic forum early in the morning. After so many years, the solutions to this problem have emerged one after another.
It can be implemented using scripts, HTC, XML + XSL, and so on, but the efficiency is different.
I learned this part when I was learning. Net today. By the way, I will review and summarize the previous knowledge discussed with you.

1. CSS + HTC (HTML component)
Microsoft's method is simple, and it has been quite popular in the Classic. To download the components prepared by Dave Massy, you only need to add behavior: URL (XXX. HTC.
However, the disadvantage of this method is that it needs to run on the server. It does not work if it runs directly on the hard disk. In addition, browsers later than ie5 are required. other browsers such as FF are not supported.
Demo: http://msdn.microsoft.com/library/en-us/dndude/html/Qual.asp
Official Address:
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/dndude/html/dude07232001.asp

2. Script Method
This is one of the most widely used methods. Like the table sorting implemented by a http://bt1.btchina.net with a script. The script source file for table sorting in btchina uses Erik Arvidsson (webfx)ProgramIt is called sortable table. The official website has powerful technical support. Visit http://webfx.eae.net/dhtml/tablesort/tablesort.htmlthis program has a relatively high efficiency.
Demo: http://webfx.eae.net/dhtml/sortabletable/demo.html
Official Address: http://webfx.eae.net/dhtml/tablesort/tablesort.html

3. windy_sk (wind2000) scriptCode.
The old master is definitely a classic master, and there are countless waves in the Classic. The earliest learning is his code. original post:
Http://www.blueidea.com/bbs/NewsDetail.asp? Id = 697036

4. There are also some codes of professional experts, which will be summarized later.
There is also the code that cainiao SIPO uses. Net to do... (don't laugh)

The core code is:
If viewstate ("sortexp") is nothing then
Viewstate ("sortexp") = E. sortexpression. tostring
Elseif viewstate ("sortexp") = E. sortexpression. tostring then
Viewstate ("sortexp") + = "DESC"
Else
Viewstate ("sortexp") = E. sortexpression. tostring
End if

Thank you for your help! Asp.net Code finally put on, Demonstration: http://www.dc9.cn/c/webform1.aspx

Thank you... a javascript control from alicloud.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.