Set EnableViewState to false - Server control to minimize size of ViewState data - ASP.NET

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

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

ANSWER: Set EnableViewState to false
 

    Discussion

  • Brijesh   -Posted on 19 Oct 15
    Set EnableViewState to false on a server control to minimize the size of the ViewState data. By default EnableViewState property is true for server control.
    In ASP.NET when a form is postback to server it reappears in the browser and all the data is available in all form controls. ASP.NET page and controls maintain their state by in hidden form field named _ViewState. By default EnableViewState property is true for server control 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.)