启用了ViewState的几个控件,并禁止他人/页 [英] Enable ViewState for few controls and disable for others/page

查看:136
本文介绍了启用了ViewState的几个控件,并禁止他人/页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ViewState禁用该页面。它不允许任何其他控件使用ViewState的。即使我设置的EnableViewState =真为特定的控制。

When I disable ViewState for the page. It does not allow any other control to use ViewState .. even if I set EnableViewState="true" for that particular control ..

是可以启用的ViewState的控制时,ViewState是针对网页本身停用?

is it possible to enable ViewState for a control when ViewState is disabled for the page itself?

如果不是如何为控制页面上除了少数禁用ViewState中不指定的EnableViewState =false的明确..键入相同的进如此多的控件是忙碌的。

if not how can disable viewstate for controls on page except for few without specifying EnableViewState="false" explicitly .. typing the same into so many controls is hectic ..

推荐答案

如果您设置翻页的ViewState关,那么有没有办法让您启用ViewState的特定组件。这是因为ViewState是递归serialzed,所以如果页面不允许ViewState的时候,它不会序列化的ViewState任何它的子控件。

If you set turn page's ViewState off, then there is no way for you to enable ViewState for specific components. This is because ViewState is serialzed recursively, so when if the Page is not allowing ViewState, it will not serialize the ViewState for any of it's child controls.

在回答你的问题,如果你不希望明确关闭ViewState个人控制,但要保留一些控制ViewState的认识,最好的办法是写果然ViewState中关闭所有控制一个小工具的方法(使用递归或其他)。然后启用ViewState中的控制,你想启用的ViewState的。

In answer to your question, if you don't want to explicitly turn ViewState off on individual controls, but want to keep some controls ViewState aware, the best way would be writing a small utility method which turns ViewState off for all controls (using recursion or otherwise). Then enable ViewState for the controls that you would like to enable ViewState for.

另外,一个中间地带,少有力的方式,可能可能的,如果控件内其他容器控件群体(如面板)。您可以通过禁用该小组的ViewState禁用ViewState的一个小组内的所有控件。

Alternatively, a middle ground and less forceful way may possible if controls are groups inside other container controls (such as Panel). You can disable ViewState for all controls inside a Panel by disabling ViewState of the Panel.

这篇关于启用了ViewState的几个控件,并禁止他人/页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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