Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ViewStateMode vs EnableViewState

Tags:

c#

asp.net

What's the difference between:

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

It's in the properties of asp.net controls.

Thanks for the explanation.

like image 656
frenchie Avatar asked Jun 24 '11 14:06

frenchie


Video Answer


1 Answers

EDIT

ViewStateMode

  • Enabled - Turns the ViewState On for this control
  • Disabled - Turns the ViewState Off for this control
  • Inherit - Inherits from the value of the parent control

EnableViewState

  • Overrides ViewStateMode, must be true for ViewStateMode to have meaning.

See: Minimizing viewstate- confused by `EnableViewState` and `ViewStateMode` in asp.net 4.0

ORIGINAL

Understanding ASP.NET View State

Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client. Control.EnableViewState Property

You can use the ViewStateMode property to enable view state for an individual control even if view state is disabled for the page. For more information about view state and control state, see the EnableViewState property. Control.ViewStateMode Property

like image 92
Brandon Boone Avatar answered Sep 25 '22 08:09

Brandon Boone