如何在网格视图中绑定数千条记录 [英] How to bind thousands of record in Grid view

查看:68
本文介绍了如何在网格视图中绑定数千条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个表中有30,000条记录,我想在网格视图中显示所有记录.
我为此编写了一个传统代码来绑定网格视图,即
gvlist.DataSource = ds;
gvlist.DataBind();

我正在ds中获取并存储的所有数据,并将此DS提供给我的网格视图,但是大约3-4分钟需要花费很多时间来加载页面.
因此,建议尽量减少页面加载时间.

I have 30,000 record in my one table, and i want to show all record in grid view.
I write a traditional code for this to bind grid view i.e.
gvlist.DataSource =ds;
gvlist.DataBind();

all data i am fetching and storing in ds and i supply this DS to my grid view,but it is taking to much time to load page around 3-4 mins.

So any suggesstions to minimise page load time.

推荐答案

您需要为此使用分页.阅读有关gridview分页的更多信息.如果您使用Google,则有很多文章.

然后,在习惯了这一概念之后,您可能想尝试这一个. [ ^ ]
You need to use paging for this one. Read more about paging in gridview. There are a lot of articles if you use google.

And then, after you get used to the concept, you might want to try this one.[^]


根本不建议您在做什么.当用户数量增加时,您的网站可能会开始提供OutOfMemory例外,许多用户会遇到超时.

使用
What you are doing is not at all recommended. When the number of users will increase, your website may start giving OutOfMemory exceptions and many users will experience time-outs.

Use GridView paging[^] to display only certain number of records on a page. The user can page through the records. You may also extend the features and add search facility for the records.

Again, there are certain performance considerations when you are getting so many records from database and using paging. You have two important things to consider:
a) memory usage on the server - DataTables will take a lot of memory if huge records are fetched at a time.
b) database hits - more the no. of hits, more time it takes to process the page.

You will have to optimize your web page to use best combination of both the techniques display so many records.

You may also search Google/Bing for displaying large records in Gridview and performance considerations.

Hope this gives you a start. ! :thumbsup:


这篇关于如何在网格视图中绑定数千条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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