What does the "EnableViewState" property do? Why would I
want it on or off?
Answer Posted / satish v itagi
Web page is a stateless entity. To preserve data between
postbacks dot net provided to containers viz. ViewState and
Session.
Viewstate enables persistence of data across post backs in
web forms of dot net (web pages). The data is stored in
hidden field/s of the page. Hence data travels across
media between server and client making loading and un-
loading slow. The advantage is every page will have its
own viewstate data. Normally web controls will have
viewstate enabled. If viewstate is turned off, other data
also can be saved in viewstate.
Objects have to be serialised before putting in viewstate.
While accessing methods and properties of an object the
object has to be properly type casted.
At times, viewstate of a page can get corrupted, requiring
the whole application to be re-started. It is not good
idea to keep large objects in viewstate.
If performance is the issue turn off viewstate, if
persistence is the issue and you have small to medium sized
data enable viewstate.
Keeping state in Sessions is also a better solution.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Why do we use sessions?
Explain server side state management system.
What is the difference between page-level caching and fragment caching?
Write a code snippet to implement the indentation in json in web api.
What are the disadvantages of asp.net?
How do I create a web form?
can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?
Differentiate between globalization and localization.
What are cookies in asp.net?
Explain what does wsdl stand for?
Are cookies stored on server or client?
What are the different method of navigation in asp.net?
What is synchronous and Asynchronous post back ?
When using the Pager object, inorder to know which page to go, which property you have to set to grid?
Which object encapsulates state or data of a user?