Viewstate Growth

Last post 07-08-2009 9:09 PM by ricka6. 6 replies.

Sort Posts:

  • Viewstate Growth

    07-02-2009, 11:50 AM
    • Member
      99 point Member
    • Sarvis
    • Member since 07-31-2006, 7:13 PM
    • Posts 58

    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?

  • Re: Viewstate Growth

    07-04-2009, 11:49 AM
    • Member
      99 point Member
    • Sarvis
    • Member since 07-31-2006, 7:13 PM
    • Posts 58

    *bump*  I really need to get this figured out soon... 

  • Re: Viewstate Growth

    07-04-2009, 1:06 PM
    • Star
      11,660 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,456
    • TrustedFriends-MVPs

     Sorry Sarvis, I've not come accorss and issue like this can you post some code e.g. custom pages and custom field templates etc.

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
  • Re: Viewstate Growth

    07-04-2009, 6:02 PM
    • Member
      99 point Member
    • Sarvis
    • Member since 07-31-2006, 7:13 PM
    • Posts 58

    Honestly the code here is... complex.  I'm basically designing a system that let's me create a heirarchical form, where you can edit child objects as well as the parent object.... the fun part being that some of the child objects don't even exist.  So some of the field templates actually create listviews or formviews, and all kinds of events are captured and trapped to make sure the forms stay in synch.


    It actually works pretty well except for this one horrible issue... :(


    Like I said though, I'll try to narrow down the problem Monday and then maybe I can post a sample that recreates it...

  • Re: Viewstate Growth

    07-04-2009, 8:17 PM
    • Star
      11,660 point Star
    • sjnaughton
    • Member since 04-29-2008, 5:11 PM
    • Newton-le-Willows, Merseyside, UK
    • Posts 2,456
    • TrustedFriends-MVPs

     I look forward to seeing that, sounds interesting Big Smile

    Steve Big Smile

    Always seeking an elegant solution.
    [Oh! If olny I colud tpye!]
    c# Bits blog
    Oh, and don't forget to mark as answer any posts that help you Big Smile
    Filed under:
  • Re: Viewstate Growth

    07-07-2009, 12:32 PM
    Answer
    • Member
      99 point Member
    • Sarvis
    • Member since 07-31-2006, 7:13 PM
    • Posts 58

    Ok, so the culprit was Telerik's RadComboBox.  More specifically, it was the lack of support for Dynamic Data using RadComboBox.  To be even MORE specific:


    The workaround for using a RadComboBox with DynamicData is to have a DropDownList with visible set to false, call the PopulateListControl on that DDL and then copy the items to RadComboBox.


    This works fine, except when you do that on every postback... I'm guessing it stuffs the entire list into Viewstate when you do it that way, and since I was doing it every postback... the viewstate kept growing.


    Is fixed now.

  • Re: Viewstate Growth

    07-08-2009, 9:09 PM
    • Contributor
      5,495 point Contributor
    • ricka6
    • Member since 06-25-2008, 10:04 PM
    • Redmond
    • Posts 907
    • AspNetTeam
      Moderator

     Thanks for posting the solution.

    Rick -ASP.Net UE MVC FAQ   Rick on MVC & Dynamic Data   
Page 1 of 1 (7 items)