views:

169

answers:

1

We have always had View State Disabled. We updated our project to WAP and changed the properties of all our projects including web to .NET 3.5. We notice now that some of our pages have more view state. Does .NET 3.5 add soemthing that we are not aware of that might turn this on or add something to view state when previously it was disabled in .NET 2.0?

+1  A: 

Even with viewState disabled

<form id="formMain" runat="server" enableviewstate="false">

the page will include some (much less than normal) viewState information.

from http://msdn.microsoft.com/en-us/library/ms972427.aspx

The page itself saves 20 or so bytes of information into ViewState, which it uses to distribute PostBack data and ViewState values to the correct controls upon postback. So, even if ViewState is disabled for the page or application, you may see a few remaining bytes in ViewState.

David Lively
yea, but we did have some turned on I saw. And those pages have a lot more it appears now that the web project is .NET 3.5 enabled. Maybe this is not possible and my teammate is just imagining things.
CoffeeAddict
Certainly seems plausible. Different framework = different control versions = different data required to be stored in ViewState. If you turn it off, though, I'd expect the size to go back down to the "20 or so bytes" mentioned in the MSDN article.
David Lively
FYI, I've disabled ViewState in my topmost-level master page, and haven't looked back. We try to find ways to avoid sending lots of sometimes-unnecessary data back and forth with each postback.
David Lively
Plus, there's such a thing as ControlState, which things like repeaters/grids etc use, which you can't disable, and is also packed into the viewstate field: http://msdn.microsoft.com/en-us/library/1whwt1k7.aspx
Zhaph - Ben Duguid