HOW TO make columns in an ASP.NET GridView sortable with jQuery
- Use the jQuery Tablesorter Plugin - see article with demo
- Note that the jQuery Tablesorter Plugin requires the table generated by the GridView to have thead and tbody tags
- Assuming the Id of the GridView server control is set to grdEmployee, you can access the dynamically generated table's ID and build the selector like this -
$('#' + gridid).tablesorter();
- If you have a checkbox in the column header to implement Select All/De-select All functionality for items in that GridView, that will fail as the Tablesorter plugin will override the click event. To overcome that, use this trick -
Also see:
Yours declaratively, GridView
Beware of breaking changes in jQuery library versions
Comments
Post a Comment