---
title: "Difference between EnableViewState and ViewStateMode properties"  
description: "Difference between EnableViewState and ViewStateMode properties"  
author: "Niraj Kumar Mishra"  
published: 2017-08-25  
updated: 2020-09-19  
canonical: https://www.mindstick.com/interview/23291/difference-between-enableviewstate-and-viewstatemode-properties  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# Difference between EnableViewState and ViewStateMode properties

1. Using EnableViewState property we only have 2 options we can turn off view state altogather, or Enable viewstate for the entire page and then turn it off on a control-by-control basis.\
\
2. If you want to turn of ViewState for the entire page and only enable it for specific control on the page, then we have to use ViewStateMode property in conjunction with EnableViewState.\
\
3. ViewSteteMode property is introduced in ASP.NET 4, where as EnableViewState exist from a long time.\
\
4. If EnableViewState is to true, only then the ViewStateMode setting are applies, where as , if EnableViewStete is set to False then the control will not save its view state, regardless of the ViewStateMode setting. In short if EnableViewState set to False, ViewStateMode setting is not respected.

\

## Answers

### Answer by Niraj Kumar Mishra

1. Using EnableViewState property we only have 2 options we can turn off view state altogather, or Enable viewstate for the entire page and then turn it off on a control-by-control basis.\
\
2. If you want to turn of ViewState for the entire page and only enable it for specific control on the page, then we have to use ViewStateMode property in conjunction with EnableViewState.\
\
3. ViewSteteMode property is introduced in ASP.NET 4, where as EnableViewState exist from a long time.\
\
4. If EnableViewState is to true, only then the ViewStateMode setting are applies, where as , if EnableViewStete is set to False then the control will not save its view state, regardless of the ViewStateMode setting. In short if EnableViewState set to False, ViewStateMode setting is not respected.

\


---

Original Source: https://www.mindstick.com/interview/23291/difference-between-enableviewstate-and-viewstatemode-properties

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
