优化的ViewState [英] Optimizing ViewState

查看:129
本文介绍了优化的ViewState的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有他们可以指出我对我的优化ASP .NET应用程序的视图状态的任何想法或引用?我不想把它关掉一起,和优化的主要目标是加快的表现,所以我不希望运行昂贵的功能递归禁用某些控件视图状态,因为该功能会减慢这会破坏目的的页面的加载时间。

Does anyone have any ideas or references they could point me to regarding optimizing the viewstate of my ASP .NET application? I don't want to turn it off all together, and the main goal of optimizing it is to speed up performance so I don't want to run an expensive function to recursively disable the viewstate for certain controls because that function would slow down the load time of the page which would defeat the purpose.

任何想法?

推荐答案

有没有很多我可以告诉你,除了不要把大量进入你的的ViewState

There's not a lot I can tell you except "don't put a lot into your ViewState".

一个我找优化:


    您添加
  • 有什么要自己ViewState的

  • 大量的数据绑定到数据显示控件像 GridView的< X>清单转发

  • Anything you added to ViewState yourself
  • Large amounts of data bound to data display controls like GridViews, <x>Lists, and Repeaters.

GridView的特别不好的ViewState ;一切你数据绑定进入,所以,如果你绑定一个特别大名单预计ASP.NET来处理它分页你,你将有一个巨大的的ViewState 。要解决这个问题的唯一方法是只在一个时间到 GridView控件绑定一个页面,但是这意味着你必须做数据端分页,它可以是只那么痛苦,或关闭的ViewState GridView控件,这意味着(可以说)非常有用的功能,如在线编辑不再可用。

GridViews are particularly bad about ViewState; everything you databind goes into it, so if you bind a particularly large list expecting ASP.NET to handle pagination of it for you, you're going to have a huge ViewState. The only way to get around this is to only bind one page at a time to the GridView, but that means you'll have to do data-side pagination which can be just as painful, or to turn off ViewState for the GridView, which means (arguably) useful features like in-line editing are no longer available.

这里没有银弹。

这篇关于优化的ViewState的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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