Asp – Why is the viewstate growing between postbacks when using dynamic data

asp.netasp.net-3.5asp.net-dynamic-datadynamic-dataviewstate

I'm writing a pretty complex web form using ASP.NET Dynamic Data. Several of the controls on this form post back, since there are dependencies between controls. I'm noticing that the viewstate is growing larger with every postback, until after 5 or so there is a long delay between the Render process and the page actually loading in the web browser.

This occurs even if I'm JUST clicking a radio button to cause the postback, without entering any data or any other changes into the form…

I checked the older version of the form, which does not use Dynamic Data, and the viewstate doesn't grow at all… so I'm theorizing that the dynamic data controls are somehow to blame…

Anyone else seen this? Is there a fix for it?

Best Answer

I don't know the direct answer to your question, but perhaps one of these tools may help you diagnose further:

(1) Fritz Onion's ViewState Decoder tool might be able to help you figure out what's getting stuffed in there. You can find ViewSate Decoder listed at the Pluralsight Tools page. Direct download link: ViewStateDecoder22.zip.

ViewState Decoder screen shot http://alt.pluralsight.com/images/decoderscreenshot.gif

(2) Another tool that may be worth looking at is ASP.NET ViewState Helper:

"[...] ASP.NET ViewState Helper is designed to help all web developers, but has specific features to help ASP.NET developers debug ViewState issues. Analyze your web pages in real-time while you browse them using Internet Explorer 6.0 or higher. [...]"