如果gridview包含更多记录,则页面需要花费很多时间才能加载 [英] the page takes so much time to load if the gridview contains more records

查看:92
本文介绍了如果gridview包含更多记录,则页面需要花费很多时间才能加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,我正面临着一个问题。



问题是,我有一个带有gridview的简单aspx页面和州和地区的两个下拉菜单。在页面加载!ispostback中,gridview与来自数据库的大约3000条记录绑定。在州下拉列表的selectedindexchanged上,区域下拉列表被绑定(此时gridview没有绑定)。但是填充区域需要花费很多时间。



但是如果在页面加载中,gridview被绑定了100-200条记录(从数据库中选择100-200条记录) )在这种情况下,该区域将在一秒钟内填充。



我无法弄清楚究竟是什么问题。所以请帮助我。

解决方案

简单的解决方案是:不要尝试加载这么多记录。



当然需要时间加载:3000记录是通过互联网泵送的大量文本(具有适当的HTML包装)。更糟糕的是,您希望您的用户能够轻松地在该批次中找到他们的记录吗?



只能填充最多约100行的用户控件,并且提供分页,搜索和过滤:它更快,更容易,更友好!


我建​​议您构建网格视图以及引导数据表插件。 https://datatables.net [ ^ ]



这将自动处理分页,排序和过滤。也很快。尝试一下。



如果你无法避免asp.net视图状态尝试使用bootstrap数据表,或者进行分页而不是一次加载所有数据。 / BLOCKQUOTE>

Dear All, I am facing a problem.

The problem is that, i have a simple aspx page with a gridview and two dropdowns for State and Districts. On page load within !ispostback the gridview is binded with about 3000 records from database. On selectedindexchanged of State dropdown the district dropdown is binded (gridview is not binded this time). But it takes so much time to populate the districts.

But if in the pageload, the gridview is binded with 100-200 records (selecting 100-200 records from database) in that case the district is populated within a second.

I cannot figure out what exactly the problem is.So Please help me.

解决方案

The simple solution is: don't try to load so many records.

Of course it takes time to load: 3000 records is a lot of text to pump across the internet (with appropriate HTML wrapping). And to make things worse, do you expect your users to find their record easily in that lot?

Only ever populate a user control with around 100 rows at most, and provide paging, searching, and filtering: it's faster, easier and a lot more user friendly!


I suggest you to build your grid view along with bootstrap data table plug-in. https://datatables.net[^]

This will automatically handle paging, sorting and filtering. Also very quick. Give it a try.

If you can't avoid asp.net view state try using bootstrap data table or else do paging instead of loading all data at once.


这篇关于如果gridview包含更多记录,则页面需要花费很多时间才能加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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