Introduction
When the jquery plug-in jquery. tablesorter is used in the project to sort the table, the code from the gridview render is uncomfortable. The default HTML structure requires the <thead/> label. As a result, tablesort cannot be used.
Is the gridview render <thead/> label?
By default (vs2008), the <thead/> <tbody/> <tfoot/> label is not displayed.
Solution
Solution 1:Modify the jquery. tablesorter plug-in so that it can be used without the thead tag. (Not implemented)
SolutionII:Find ways to make the gridview render output <thead/> and other labels to cater to the default structure of jquery. tablesorter.
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
After gridview1 is bound to the data source, add the preceding code to render the <thead/> label.
SolutionIII:Use jquey to wrap the <thead/> label in the first line of the table, and insert it to the <tbody/> label.
$(function() { $("#GriView1 tr:first").wrap("<thead></thead>"); $("#GriView1 thead").insertBefore("#GriView1 tbody"); $("#GriView1").tablesorter(); });