限制对AJAX调用视图状态信息 [英] Limiting view state information on AJAX calls

查看:130
本文介绍了限制对AJAX调用视图状态信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个报名表,并在同一页上的GridView。从GridView的选择行填充它在上面的报名表文本框与GridView控件行的所有条目。

I have an Entry Form and a GridView on the same page. Selecting a row from the GridView populates the TextBoxes in the Entry Form above it with all the entries of the GridView row.

在本页面打开任何行从GridView的选择,我可以看到很多视图状态数据的发送与每个AJAX请求服务器。我选择的浏览器的查看源文件选项进行检查。我试图通过使用禁用视图状态在页面顶部:=的EnableViewState假,但我的应用程序停演正确

When this page opens and any row is selected from the GridView, I could see a lot of View State data being sent to the server with each AJAX request. I selected View Source option of the browser to check this. I tried disabling the View State on top of the page by using: EnableViewState = "false", but my application stopped performing correctly.

在从GridView控件中选择任何行,将产生错误,所以我重新启用视图状态。

On selecting any row from the GridView, error is generated and so I re-enabled the View State.

有没有办法使用视图状态,并保持AJAX请求任何小优化的方式?任何视图状态COM pression以及相关的?

Is there any optimized way to use View State and keep AJAX requests small? Anything related to View State compression as well?

我使用ASP.NET 2.0。

I am using ASP.NET 2.0.

推荐答案

从您使用的UpdatePanel ,开箱即用AJAX的时刻叫你正在坚持的发送所有表单POST数据,包括大的视图状态。

From the moment that you use UpdatePanel, out of the box ajax call you are stick to send all form post data, including the big view state.

您有两种方式,一种是做定制, AJAX调用都集中只对更改你控制,而不是完全回发的UpdatePanel那做。

You have two ways, one is to make custom made, ajax call that are focused only to the change that you control, and not the full post back that UpdatePanel do.

另一种方法是,以尽量减少哪一页每邮寄背背,和 COM preSS视图状态

The other way is to minimize what page send back with each post back, and compress the viewstate.

要融为一体preSS视图状态,我建议这里有些页面有准备使用源$ C ​​$ C。

To compress the viewstate I suggest some pages here that have ready to use source code.

HTTP://www.$c$cproject。 COM /条/ 14733 / ViewState的-Com的pression

http://www.hanselman.com/blog/ZippingCom$p$ pssingViewStateInASPNET.aspx

<一个href=\"http://www.bloggingdeveloper.com/post/How-To-Com$p$pss-ViewState-in-ASPNET-20-ViewState-Com$p$pssion-with-SystemIOCom$p$pssion.aspx\" rel=\"nofollow\">http://www.bloggingdeveloper.com/post/How-To-Com$p$pss-ViewState-in-ASPNET-20-ViewState-Com$p$pssion-with-SystemIOCom$p$pssion.aspx

和我做了一个类似的问题:
<一href=\"http://stackoverflow.com/questions/2771895/how-to-limit-the-number-of-post-values-on-updatepanel\">How以限制的UpdatePanel后的值的数目?

and a similar question that I did: How to limit the number of post values on UpdatePanel?

这篇关于限制对AJAX调用视图状态信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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