开发者

Implement javascript sorting in a asp.net grid view

开发者 https://www.devze.com 2022-12-20 04:48 出处:网络
How can I accomplish gridview sorting in client browser using javascript ? without using inbuilt gridview sorting method. I really dont want the gridview to go t开发者_如何学Pythono the DB each time w

How can I accomplish gridview sorting in client browser using javascript ? without using inbuilt gridview sorting method. I really dont want the gridview to go t开发者_如何学Pythono the DB each time while sorting.


Try the jQuery plugin tablesorter

<script type="text/javascript" src="/path/to/jquery-latest.js"></script> 
<script type="text/javascript" src="/path/to/jquery.tablesorter.js"></script>

....

<script type="text/javascript">
    var aspxElements = {
        theGrid: '<%= myGrid.ClientID %>' //I'm not entierly sure this is the id of the table or some container element
    };

    $(document).ready(function() { 
        $('#' + aspxElements.theGrid).tablesorter(); 
    });
</script>

(modified from the demo on this page)

Note that this will get weird if you're using pagination.

0

精彩评论

暂无评论...
验证码 换一张
取 消