Thursday, June 7, 2012

Solution for Grid view sorting at client side instead of Server side

Recently during the code review I have identified the performance issue Grid view Server side sorting . To avoid the server side sorting I have implemented

client side sorting using jQuery plugin. Here is the implementation steps for Client side sorting.

Step#1

=>Download the tablesorter plugin min JavaScript and place into script folder

=>Add the reference to sorting required page

Ex:

<script src="../Scripts/jquery.tablesorter.min.js" type="text/javascript"></script>

Add this script into JavaScript block



$(document).ready(function () {
$("#ctl00_ContentPlaceHolder_gvMyStyles").tablesorter(); 
});

Step#2

Place these two lines of code after the gridview bind



gvMyStyles.UseAccessibleHeader = true;  
gvMyStyles.HeaderRow.TableSection = TableRowSection.TableHeader; 
 

1 comment:

  1. I have been browsing on-line more than 3 hours these days, yet I never discovered
    any interesting article like yours. It's lovely worth sufficient for me. In my opinion, if all website owners and bloggers made excellent content material as you probably did, the web can be a lot more useful than ever before.

    Also visit my web-site ... visit the next website page

    ReplyDelete