The VIEWSTATE size is killing our apps and it keeps growing. The .aspx files are bigger than 2.5Mb in some cases.

The developer is on vacation and I just installed a 90 day trial of VS 2008 to test turning form-level VIEWSTATE off then turning it on again to see if the VIEWSTATE gets reduced substantially. It didn't. It went right back to the same size.

When VIEWSTATE was off the page size was 650K. With it off I tested changing one combo field and it worked. The problem is that some pages are complicated with grids and custom user controls, so I am sure that disabling it can possibly affect whether some of these fields work at all. Is this true?

Our server is Win Server 2008 Enterprise.

Any ideas to reduce the size of VIEWSTATE and keep the app running? I need to get this fixed today.

This is an extremely important app that people across the US are using, and any help is greatly appreciated.

Viewstate is used to persist values of controls across postbacks. For example, say you had a form where you fill out name, address, etc. but you forgot your email address. When you submit it the code behind says "need email address" and returns the page so you can fill out the missing value. Without viewstate every box would (without server side coding) be empty. Viewstate makes it easier of the developer in this situation.

Everything should work without viewstate, if it was done right.

I suspect that the grid controls are your problem (along with the custom controls that display a lot of data).

Try turning off viewstate for any gridviews on a page to see if that is what is causing the problem. You do that by adding doing this:

<asp:GridView ID="GridView1" runat="server" EnableViewState="false">

Note the EnableViewState property. You can do that with any custom controls, also.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.