ViewStateMode vs EnableViewState

前端 未结 5 474
盖世英雄少女心
盖世英雄少女心 2020-12-29 18:34

What\'s the difference between:

  • ViewStateMode: Disabled / Enabled / Inherit
  • EnableViewState: True / False

It\'s in the properties of as

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 18:53

    The combination allows you to turn off the ViewState for a page as a whole, but enable it for a specific control contained inside.

    To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page to Disabled, and set the ViewStateMode property of the control to Enabled.

    The default value of the ViewStateMode property for a page is Enabled. The default value of the ViewStateMode property for a Web server control in a page is Inherit. As a result, if you do not set this property at either the page or the control level, the value of the EnableViewState property determines view-state behavior.

    From Control.ViewStateMode Property

提交回复
热议问题