如何在Asp.net中分页 [英] how to Paging in Asp.net

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

问题描述



我有一个非常基本的疑问.

如何在gridview中显示一百万个数据.

我对gridview分页有个想法,但是只做gridview分页就可以了

工作,每次服务器发生网络往返.


而且我只知道sql server分页.

怎么做,

我亲爱的技术人员,

请回复我.

问候
James

Hi,

I had a very basic doubt.

how to display a one million of data into gridview.

i have idea about the gridview paging,but just doing simply gridview paging will do

work, and every time the network round trip happen to the server.


and i just aware of sql server paging.

how to do ,

My Dear Techies,

Kindly Revert me.

Regards
James

推荐答案

您确实不需要,也不应该带回数百万行.没有人会需要看到这么多数据,而且也不知道该怎么做.

最多带几百行;可能是在那个时间点与用户相关的预先过滤的子集.如果他们需要查看更多或不同的记录,请给他们一个过滤器(可以是很全面的),然后他们可以拉回他们需要查看的实际记录,而不是撤回所有需要花费大量时间和压倒性的记录.

实现此功能的方法有很多,因此我将留给您进行研究并找出哪种方法适合您的需求.

祝你好运.
You really don''t need and should not bring back millions of rows. No one will ever need to see that much data and wouldn''t know what to do with it anyway.

Bring back a few hundred rows, at most; perhaps a pre-filtered subset that would be relevant to the user at that point in time. If they need to see more or different records give them a filter (can be quite comprehensive) and they can then pull back the actual records they need to see rather than everything which would take ages and be overwhelming.

There are many different ways to accomplish this functionality so I''ll leave it to you to do your research and figure out which method suits your requirement.

Good luck.


谷歌在29分钟后发现了一个非常简单的方法.

解决方案之一是使用linq.

使用LINQ在GridView中进行自定义分页.
after 29 min google found a very easy for this.

using linq is one of solution for this.

Custom Paging in GridView Using LINQ.
public IQueryable BindEmployees(int startRowIndex, int maximumRows)
    {
        EmployeeInfoDataContext dbEmp = new EmployeeInfoDataContext();
        var query = from emp in dbEmp.Employees
                    join dept in dbEmp.Departments
                        on emp.DeptID equals dept.DeptID
                    select new
                    {
                        EmpID = emp.EmpID,
                        EmpName = emp.EmpName,
                        Age = emp.Age,
                        Address = emp.Address,
                        DeptName = dept.DepartmentName
                    };
 
        return query.Skip(startRowIndex).Take(maximumRows);
    } 


http://www.codedigest.com/Articles/ASPNET/153_Custom_Paging_for_GridView_using_LINQ.aspx [ ^ ]


http://www.codedigest.com/Articles/ASPNET/153_Custom_Paging_for_GridView_using_LINQ.aspx[^]


hii请请参考

http://www.c-sharpcorner.com/UploadFile/rohatash /gridview-paging-sample-in-Asp-Net/ [ http://msdn.microsoft.com/en-us/library/aa479347.aspx [ ^ ]
hii please refer this

http://www.c-sharpcorner.com/UploadFile/rohatash/gridview-paging-sample-in-Asp-Net/[^]

and

http://msdn.microsoft.com/en-us/library/aa479347.aspx[^]


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

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