EnableViewState - Property modified on server control to minimize size of ViewState data

Q.  What property do you modify on a server control to minimize the size of the ViewState data?
- Published on 16 Jun 15

a. ViewState=”true”
b. Set EnableViewState to false.
c. Set EnableViewState to true.
d. None of the above

ANSWER: Set EnableViewState to false.
 
In ASP.NET when a form is postback to server it reappears in the browser with all form values. ASP.NET page and controls maintain their state by in hidden form field named _ViewState. By default it is enable for all server controls and sometimes create problem because unnecessary data are stored in this field. To minimize the size of the ViewState data, set EnableViewState to false.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)