分页和自定义分页 [英] paging and custom paging

查看:87
本文介绍了分页和自定义分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解asp.net中的分页和自定义分页之间的区别

I can not understant difference between paging and custom paging in asp.net

推荐答案

关于分页,ASP.NET提供了两种分页模型:默认分页和自定义分页 - 这两个型号提供性能与易于设置/配置/使用之间的权衡



默认分页,每次显示新的数据页面时,都会从GridView的数据源中重新获取所有数据。返回所有数据后,GridView会根据用户正在查看的数据页面以及每页显示的记录数量,有选择地显示整个数据集的一部分。这里要理解的关键是每次加载一页数据 - 无论是在查看第一页数据时的第一页访问,还是在请求查看不同数据页后用户回发 - 整个数据结果被检索。

在哪里

使用自定义分页,开发人员必须做更多工作。而不是仅仅能够盲目地将GridView绑定到数据源控件并选中启用分页复选框,您必须配置数据源控件以选择性地仅检索应该为特定页面显示的那些记录。这样做的好处是,在显示第一页数据时,您可以使用仅检索产品1到10的SQL语句,而不是全部150条记录。但是,您的SQL语句必须聪明,才能知道如何从150中删除正确的记录子集。
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.




S.No 类别 产品 价格 状态
1 服装 North Jacket

S.No Category Product Price Status
1 Clothing North Jacket


189.99
库存
2 鞋子 耐克
189.99
In-stock
2 Shoes Nike


这篇关于分页和自定义分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆