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

问题描述



我正在复杂的仪表板中使用几个更新面板...
现在,我的更新面板每隔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

推荐答案

<@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.="




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

11-03 12:33