Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can not understant difference between paging and custom paging in asp.net
Posted

About paging, ASP.NET provides two paging models: default paging and custom paging - The two models provide a tradeoff between performance and ease of setting up/configuring/using

With default paging, each time a new page of data in displayed, all of the data is requeried from the GridView's data source. Once all of the data has been returned, the GridView selectively displays part of the entire set of data, based on the page of data the user is viewing and how many records per page are displayed. The key thing to understand here is that every single time a page of data is loaded - be it on the first page visit when viewing the first page of data or when the user postsbacks after requesting to view a different page of data - the entire data result is retrieved.
WHERE AS
With custom paging, the developer have to do a bit more work. Rather than just being able to blindly bind the GridView to a data source control and check the "Enable Paging" checkbox, you have to configure the data source control to selectively retrieve only those records that should be shown for the particular page. The benefit of this is that when displaying the first page of data, you can use a SQL statement that only retrieves products 1 through 10, rather than all 150 records. However, your SQL statement has to be "clever" enough to be able to know how to just snip out the right subset of records from the 150.
 
Share this answer
 

S.No Category Product Price Status
1 Clothing North Jacket $189.99 In-stock
2 Shoes Nike $59.99 In-stock
3 Electronics LED TV $589.99 Out of stock
4 Sporting Ping Golf $159.99 In-stock
5 Clothing Sweater $19.99 In-stock
6 Clothing North Jacket $189.99 In-stock
7 Shoes Nike $59.99 In-stock
8 Electronics LED TV $589.99 Out of stock
9 Sporting Ping Golf $159.99 In-stock
10 Shoes Nike $59.99 In-stock
11 Electronics LED TV $589.99 Out of stock
12 Sporting North Jacket $159.99 In-stock



// css


table, th, td {
cellpadding:1px;
cellspacing:1px;
}
th{
background:#B4F114;
}
.active {
background:red;
}



// jquery



$(document).ready(function(){
$('#data').after('<div id="nav"></div>');
var rowsShown = 4;
var rowsTotal = $('#data tbody tr').length;
var numPages = rowsTotal/rowsShown;
for(i = 0;i &lt; numPages;i++) {
var pageNum = i + 1;
$('#nav').append('<a href="#" rel="'+i+'">'+pageNum+'</a> ');
}
$('#data tbody tr').hide();
$('#data tbody tr').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;
$('#data tbody tr').css('opacity','0.0').hide().slice(startItem, endItem).
css('display','table-row').animate({opacity:1}, 300);
});
});


http://jqueryasp.net/table-pagination-using-jquery-example/[^]
 
Share this answer
 
Comments
CHill60 25-Jun-15 6:53am    
What is this supposed to be? It's not a solution to the question asked

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900