0

我对 Asp.Net 很陌生。

到目前为止,我看到的几乎所有控件都有ViewState

所以,我的问题是是否有任何控件没有ViewState?这些是什么。

我已经google了,但没有找到正确的解决方案。

谢谢 !!

4

1 回答 1

3

Every control has ViewState because that is where all attribute values are stored.

To avoid ViewState you can disable it on the control (EnableViewState=false) and make sure when you set any properties (like Text, Visible etc.) you do that yourself on every postback (so that ViewState is not needed) - so in events like Page_Load instead of Button_Click.

于 2013-06-13T10:07:58.230 回答