Difference
between EnableViewState and ViewStateMode properties
-
S.No EnableViewState ViewStateMode 1 Property Introduction:EnableViewState exists from a long timeProperty Introduction:ViewStateMode property is introduced in ASP.NET 42 Available Values:EnableViewState property only accepts true or false valuesAvailable Values:ViewStateMode property can have a value of - Enabled, Disabled and inherit.3 Default Value:TrueDefault Value:Inherit4 What EnableViewState does ?To enable ViewState at Page levelWhat ViewStateMode does ?To enable ViewState at Control level5 How 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.
Summary:
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.
"Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.php jobs in hyderabad.
ReplyDelete"