Moving ViewState to the bottom of the page
29 Nov 2010
ViewState is ASP.NET’s way of simulating state in the otherwise state-less web
environment. It is a bag of bytes that is sent back and forth between the client
and server. It is then deserialized by the server, which can use it to restore a
previous state in its components.
ViewState comes with a price (many, in fact), and you need to use the
technoology with cautios. For instance, since it is a bag of bytes, everything
you store in it adds to the page size.
View state is by default sent topmost in the web page, in a hidden text field in which the encoded data is stored. If the view state grows, this means that other content will be pushed down, which may cause content to load slower since it has to wait for the bytes to be sent. In a project that I’m currently working on, we managed to speed up page rendering a lot by moving view state to the bottom.
This is quite straightforward to do. I followed this tutorial and was good to go in a minute or so.