如何在ASP.Net 4.0中进行自定义分页 [英] How to do Custom Paging in ASP.Net 4.0

查看:94
本文介绍了如何在ASP.Net 4.0中进行自定义分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有大量数据.我编写了具有一些复杂查询的存储过程,以从数据库中获取数据.为了获得性能,我不想执行两次SP.

1.在Asp.Net 1.1中,我使用了具有VirtualItemCount的DataGrid.因此,这达到了我们的目的,但是DataGrid存在其他ViewState问题,并且没有Ajax支持.

2.在Asp.Net 2.0中,从GridView中删除了VirtualItemCount属性.但是,它为我们提供了具有缓存支持的ObjectDataSource.它需要两种方法:一种用于完成记录,另一种用于获取分页的正好总计项目数.
在这一点上,我不想只为了总数而两次执行sp.

3.在Asp.3.5中,新的DataPager可以自定义分页布局,而自定义分页则没有任何内容.
我尝试使用SQLDataSource,但是它也需要两个select方法,但是我不喜欢这样.

目前,我已经使用自定义的gridview解决了我的问题.
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=19058 [^ ]

这是Asp.net 4.0的正确解决方案吗?
如果没有,请给我任何样品来解决这个问题.

我的应用程序具有三层体系结构.

谢谢
Anjum Rizwi

I have large volume of data in my database. I have written stored procedure that have some complex query to fetch the data from Database. To achieve the performance, I don''t want want to execute my SP twice.

1. In Asp.Net 1.1, I have used DataGrid that was having VirtualItemCount. So this serverd our purpose however DataGrid was having other ViewState issue and no Ajax Support.

2. In Asp.Net 2.0, VirtualItemCount property removed from GridView. However it gave us ObjectDataSource with Cache Support. It requires two method one for fectch the record and other for to get the just total Item count for paging.
At this point, I dont want to execute sp twice just for total count.

3. In Asp.3.5, new DataPager comes to customize the Paging layout but nothing for Custom paging.
I have tried to use the SQLDataSource but it also requires two select method however I dont like this.

Currently I have solved my problem using customized gridview.
http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=19058[^]

Is it right solution for Asp.net 4.0?
If not please give me any sample to solve this problem.

My application have three tier architecture.

Thank you,
Anjum Rizwi

推荐答案

看看使用LINQ,ListView,DataPager和ObjectDataSource构建自定义分页 [^ ]

我认为这很漂亮.



1.大数据集性能的解释
[ ^ ]
请注意,它是10万,是您的4倍.

2. Linq到sql-第3部分查询我们的database.aspx [在使用SQL 2005时,LINQ to SQL将使用ROW_NUMBER() SQL函数来执行数据库中的所有数据分页逻辑.这确保了在当前页面视图中仅需要10行数据当我们执行时从数据库返回 ..."

还不够吗?
3.
LINQPad示例 [
Take a look at Building Custom Paging with LINQ, ListView, DataPager and ObjectDataSource[^]

I think it''s nifty.



1. Large Dataset Performance Demystifie
[^]
Mind you it is 100k, which is 4 times larger than yours.

2. Linq to sql-part 3 querying our database.aspx[^]
I want to stress this paragraph. "When working against SQL 2005, LINQ to SQL will use the ROW_NUMBER() SQL function to perform all of the data paging logic in the database. This ensures that only the 10 rows of data we want in the current page view are returned from the database when we executed..."

Not enough ?
3. LINQPad example[^]

Adios.


这篇关于如何在ASP.Net 4.0中进行自定义分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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