Pro: Reduces the weight of the page by not sending what can amount to a lot of data in the hidden viewstate field.
Con: Requires server memory. Depending on your user base this could have a large impact. Also consider ramifications in a web farm environment.
In general, you can often reduce your viewstate by simply doing some optimization of your pages. Many of the controls don't need viewstate. Others can be reworked a bit to eliminate the need for viewstate on controls that initially do require it. One good example is paging in a datagrid/gridview. The page number is part of viewstate. However, so is all the data for the current page. It isn't necessary to carry all the data in viewstate to make paging work, however because the data and page number are all in viewstate you have to have it enabled. Instead of relying on the internal page number, you can instead save the page number to a separate hidden field and handle it yourself. This can significantly reduce your viewstate by removing the grid's data from it.
Another way to reduce viewstate can be to use ajax. If you break up the page into update panels you can isolate those that actually need to change and only generate traffic for those elements that need to update.
-Peter
|