CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Raymond Lewallen

Framework Design, Agile Coach, President Oklahoma City Developers Group, Microsoft MVP C#, TDD, Continuous Integration, Patterns and Practices, Domain Driven Design, Speaker, VB.Net, C# and Sql Server

Viewstate chunking

I was away from my computer all weekend, so I'm playing a bit of catchup today on my blog posts. There is no direct upper limit on the size of a viewstate. Limitations come into play when the browser limits the size of hidden fields. A capability to look for in Whidbey is chunking view-state. This is intended for situations where the view-state field becomes very large and certain firewalls or proxies may prevent a page if a hidden field is considered to be too big. In this case, a developer will be able to configure the view-state so it can be broken into multiple hidden fields. This is accomplished by the developer providing a cut-off size for a single view-state field. The cut-off size will have no upper or lower limit, although setting the cut-off to be very low will hurt performance. This can be valuable when dealing with large datasets bound to datagrids and other instances where you get a very large viewstate. Be aware though, this chunking capability doesn't replace the fact that viewstates should be kept as small as possible, and even turned off where applicable.

Currently listening to: Heartcatchthump - Chainsaw Kittens


Comments

Brendan Tompkins said:

I can see the need for this, but don't you think any app needing to chunk the viewstate has some, well, design issues? I guess I'd just recommend that other state mechanisms are explored before cramming it all in a huge ViewState.
# February 22, 2005 6:46 AM

Raymond Lewallen said:

I absolutely agree, Brendan. That's why I stated "...chunking capability doesn't replace the fact that viewstates should be kept as small as possible...". However, there has been enough concern over it in the last 3 years that Microsoft implemented chunking. I don't know what each browsers limitation on hidden field size is, and have not run into this problem, yet, that I know of. I do have some very large datagrids though, and anticipate that there are some users out there that may be experiencing a problem and not reporting it.
# February 22, 2005 7:08 AM

Brendan Tompkins said:

Okay, good! :) I just have gone viewstate crazy in the past, because it was so easy to do. It came back to bite me... Most of my bloated viewstate stuff was due to datagrids. I've ended up turning viewstate off, and managing it on the server, which isn't the easiest thing in the world to do. I wonder if a post on how to do this would be useful.
# February 22, 2005 8:33 AM

Raymond Lewallen said:

Already working on the post to demonstrate viewstate chunking ;)
# February 22, 2005 8:35 AM

Scott Galloway said:

Raymond- check out Paul Wilson's stuff on this http://weblogs.asp.net/pwilson/archive/2003/08/21/24867.aspx
Personally I've switched a couple of recent apps to using some Server Side Viewstate stuff I wrote (with background cleanup bits) - gets the advantages of ViewState without the hassle of custom state management (and without the memory implications of Cache, statics etc...)
# February 22, 2005 8:47 AM

TrackBack said:

# February 23, 2005 12:33 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Raymond Lewallen

Working primarily in the public sector during his career, Raymond has designed and built several high profile enterprise level applications for all levels of the government. Raymond now works as a solutions architect for EMC. Raymond is an agile coach, Microsoft MVP C# and also president of the Oklahoma City Developers Group and Oklahoma Agile Developers Group. Raymond spends a lot of his time learning and teaching such things as Test Driven Development, Domain Driven Design, Design Patterns and Extreme Programming practices and principles, to name a few. Raymond is also an advocate of Alt.Net. Raymond is primarily a framework guy, so don't ask him anything about UI :) Check out Devlicio.us!