Asp.net结合​​大数据视图,以数据网格 [英] Asp.net binding big dataview to DataGrid

查看:212
本文介绍了Asp.net结合​​大数据视图,以数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大约2000个行的数据视图。在页面加载我想要的数据视图绑定到对象的DataGrid:

I have a dataview with around 2000 rows. At page load I want to bind the dataview to an object datagrid :

    dataGrid.DataSource = dv;
    dataGrid.DataBind();

然而,响应时间是非常高的(一两分钟)。我能做些什么,以使其更快?或者说,至少我不能freeeze客户端?

However the time response is very high (a couple of minutes). What can I do to make it faster ? Or at least can I not freeeze the client ?

推荐答案

首先检查您的查询。一旦你拥有了它一样快,您可以得到它(包括在夜间临时表什么的可能pre-缓存数据),然后移动到ASP.NET code,并做出更快。

Check your query first. Once you have it as fast as you can get it (including possibly pre-caching data nightly in a temp table or something) then move to the ASP.NET code and make that faster.

如果你可以关闭ViewState中为网格。视图状态将极大提升你的页面大小。你的问题的一部分将刚煮好的原始HTML和视图状态的MB的,然后渲染它。

Turn off viewstate for your grid if you can. The viewstate will increase your page size dramatically. Part of your problem will be just serving up the MB's of raw HTML and viewstate and then rendering it.

步骤我想借此:


  1. 关闭视图状态网格

  2. 如果您正在使用模板列中的,尝试通过组合控制,以减少重复绑定是发生量修剪下来。

  3. 在模板中使用的文字控件时,可能(比标签显著轻)

  4. 拉出所有的造型,并确保您在使用CSS来搞垮页面大小为好。

  5. 如果您的行具有任何JavaScript,请考虑删除任何内嵌脚本和应用一次通过jQuery或其他方法加载页面。

  6. 想想分页数据

您可以得到2K +记录到一个页面上工作,但你必须让事情变得很紧这样做。

You can get the 2k+ records to work on one page but you will have to make things very tight to do so.

不得已,摆脱了网格,只是直接使用文字控制和输出原材料,干净,紧HTML它。请务必关闭视图状态在这种情况下,字面控制为好。

Last resort, get rid of the grid and just use a literal control and output raw, clean, tight html directly to it. Make sure to turn off viewstate for the literal control in this case as well.

这篇关于Asp.net结合​​大数据视图,以数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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