如何摆脱更新面板中的视图状态... [英] How to get rid of viewstates in update panel...

查看:56
本文介绍了如何摆脱更新面板中的视图状态...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在复杂的仪表板中使用几个更新面板...
现在,我的更新面板每隔5秒更新一次用户列表(在线谁离线),在萤火虫跟踪中,我发现更新面板发送了30KB的请求和响应.

当进一步追踪时,我发现它在请求和响应主体中都附加了所有视图状态.

如果我们通过jquery使用原始的ajax,则不会发生这种情况.
我通过谷歌搜索发现,它是ASP.NET更新面板的肮脏秘密,它会在其回调中传输所有其他数据和视图状态..

任何摆脱视图状态的想法?????

谢谢

Hey

i am using couple of update panels in a complex dashboard...
Now my update panel updated a list of users (who''s online who''s offline) in every 5 seconds, on the firebug trace i found the update panel sending 30KB of request and response.

When traced further i found that its attaching all the viewstates with it in both request and response body.

This behavior doesn’t happen if we use raw ajax via jquery.
I found via googling that its a dirty secret of ASP.NET Update Panel transmits all other data and viewstates in its callback..

Any ideas to get rid of the viewstates ?????

Thanks

推荐答案

如果您不想使用viewstate,请将其关闭.使用页面指令

If you don''t want to use viewstate turn it off. Either using a page directive

<@page EnableViewState="false" ...>



或控件上的



or on the control(s)

<asp:updatepanel enableviewstate="false" ...>



请记住,尽管禁用viewstate也有一些影响,例如未维护控件的状态(如列表选择,复选框状态).="



Keep in mind though disabling viewstate has ramifications also, such as the state of controls not being maintained, like list selection, checkbox status.="


ok

这是一篇帮助文章

更新面板有时可能是邪恶的


在我的场景中,除了在页面中寻找其他东西来对其进行优化或使用原始ajax代替更新面板之外,我无法解决很多问题
ok

this is an article of help

update panel can be evil sometimes


in my scenario i can''t do much of my problem, except looking for other stuffs in my page to optimize it or use raw ajax in place of update panel


这里是一个解决方案:从UpdatePanel调用中删除视图状态
Here''s a solution: Remove View State from UpdatePanel Call


这篇关于如何摆脱更新面板中的视图状态...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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