$(document).ready(function () { $('#GridView1').after('<div id="nav"></div>'); var rowsShown = 5; var rowsTotal = $('#GridView1 tbody tr').not(':first').length; var numPages = rowsTotal / rowsShown; for (i = 0; i < numPages; i++) { var pageNum = i + 1; $('#nav').append('<a href="#" rel="' + i + '">' + pageNum + '</a> '); } $('#GridView1 tbody tr').not(':first').hide(); $('#GridView1 tbody tr').not(':first').slice(0, rowsShown).show(); $('#nav a:first').addClass('active'); $('#nav a').bind('click', function () { $('#nav a').removeClass('active'); $(this).addClass('active'); var currPage = $(this).attr('rel'); var startItem = currPage * rowsShown; var endItem = startItem + rowsShown; $('#GridView1 tbody tr').not(':first').css('opacity', '0.0').hide().slice(startItem, endItem). css('display', 'table-row').animate({ opacity: 1 }, 300); }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)