views:

96

answers:

6

Hi All,
just wanna ask what is acceptable size of ViewState per page? What is the level I should start worried.
Is there any objective measurement for viewstate size?

Thanks for any opinion :-) Cheers, X.

A: 

It depends.....If you have 1 user then size is not as important compared to if you have a million users. You also need to know how much RAM you have and if you are running out of RAM

SQLMenace
+1  A: 

This would depend on your end-users. For a internal application where the size of the page is not an important criteria, I would not worry too much about it.
Viewstate is not a problem in itself, it is a problem when it starts slowing down your application because it sends this viewstate back and forth between your client and your server.

You have to consider that the viewstate is sent to the user to be rendered in the source of the page, but it will also be sent back to your server to keep the state of this page, and it will be loaded in memory.

If your end users have a slow internet connection, the bigger the page is , the slower and the more painfull it will be for them.

If your hosting provider is billing you depending on the data transfered, you might want to reduce it as much as possible too. especially if you have a lot of users...

Also consider the memory available on your server as the viewstate is loaded in the RAM for each request, for each user.

Stephane
A: 

I'm not sure that there is an "acceptable size" for a viewstate - it just depends on the size and complexity of your page. I know that its easy for it to become bloated and much bigger than it needs to be - a couple weeks ago we decoded our viewstate and found we could reduce it by about 40% on some of our larger pages.

Your viewstate should be as big as it needs to be. Just make sure to keep an eye on it to make sure it isn't bloating up with information that is completely unnecessary to a postback.

Jarrod
+1  A: 

I think it basically depend on what you have to achieve, and how much you are using it for "intentional" purposes. Anyway there are ways to measure, decode and optimize it:

http://jagbarcelo.blogspot.com/2009/03/viewstate-size-minimization.html

http://articles.techrepublic.com.com/5100-10878_11-5229520.html

http://scottonwriting.net/sowblog/posts/4409.aspx

mamoo
+2  A: 

You need to make it smaller than a Borg Cube:

http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx

ViewState will add your web app's distinctiveness to it's own. Performance is futile.

Greg
A: 

It depends on a lot of factors. A page with a lot of controls & content will have a lot more viewstate. What's acceptable, depends on the bandwidth limitations you have. If it's an internal company application and doesn't have a lot of users, a bigger viewstate(200-500k) may be acceptable. If it's on the web or a lot of users will be on it, you should limit the viewstate.

To limit viewstate, look at ways to improve your UI so it's not as complicated. Modal pop ups such as the Telerik RadWindow to are a good way to move some controls out to another page, while preserving the interaction between the pages.

On complicated pages, Tabs are also a good way to improve UI..each Tab can be it's own page.

Ed B