S.No EnableViewState ViewStateMode 1Property Introduction:EnableViewState exists from a long timeProperty Introduction:ViewStateMode property is introduced in ASP.NET 4 2Available Values:EnableViewState property only accepts true or false valuesAvailable Values:ViewStateMode property can have a value of - Enabled, Disabled and inherit. 3Default Value:TrueDefault Value:Inherit 4What EnableViewState does ?To enable ViewState at Page levelWhat ViewStateMode does ?To enable ViewState at Control level 5How to use ?Using EnableViewState property we can have one of these 2 options.i. We can turn off view state altogether by setting its value to false in web.config file,orii.Enable viewstate for the entire page and then turn it off on a control-by-control basis.How to use ?Steps involved to disable view state for a page and to enable it for a specific control on the page,i. Set the EnableViewState property of the page and the control to true,ii. Set the ViewStateMode property of the page to Disabled, andiii. Set the ViewStateMode property of the control to Enabled.
EnableViewState vs ViewStateMode
Difference between EnableViewState and ViewStateMode properties
1. If EnableViewState is to True, only then the ViewStateMode settings are applied.
2. In other words, if EnableViewState is set to False, ViewStateMode setting is not respected
3. Therefore, we have to use ViewStateMode property in conjunction with EnableViewState.