View State in Asp.net 4.0

ASP.NET 4.0 offers a new mechanism to enable/disable the view-state, controlling it becoming much easier than before. To store their state, ASP.NET controls have used view-state, enabled by default until now. This behavior resulted sometimes in large amounts of data being transferred between the client and the server.

The whole concept of view-state in ASP.NET is thoroughly covered in the blog post Truly Understanding Viewstate, by Dave Reed back in August 2006 and is recommended reading for all developers working on the ASP.NET platform. As Dave points out, “ViewState is a very misunderstood animal”, and should be used with care. Developers that have not experienced how view-state works, have sometimes been surprised when looking at the HTML returned to the client browser. If one is not conscious of how view-state is used, the size of the page returned to the user can be extremely big, resulting in potentially low performing websites.

To summarize, this allows to:

  • Disable on page, enable on specific controls
  • Disable on control, enable on child controls

Also GridView/ListView is promised to work better without view-state.

Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami