ViewState Data - IDictionary: System.Collections.Specialized.HybridDictionary [Items:306] RRS feed

  • Question

  • User-219456107 posted

    I noticed that the size of one of my pages was particularly large. I snooped around the View State and noticed That this object has 306 members all from the same repeater. The specific members are listed as

    0. Key: "ctl00$main$ctl100$RepeaterProjectGateway$ctl213$ListViewProjectContacts", Value: "System.Web.UI.Pair"

    How is this being added to the viewstate? EnableViewState="False" is set on the ListView and also on the control.

    Saturday, January 16, 2016 8:52 PM

All replies

  • User465171450 posted

    Viewstate for the page can be over-ridden by controls. Controls can also have their own ControlState, which was a concept introduced in the 2.0 framework. http://forums.asp.net/post/set/22/2082800/6011156

    Saturday, January 16, 2016 10:39 PM
  • User-2057865890 posted

    Hi David,

    In many situations, ASP.NET View State becomes very large especially when your ASP.NET application has a lot of rich and heavy controls and widgets on its pages. This results in a lot of data traveling back and forth between your browser and the web server.
    You have several options to reduce the ViewState.
    Disable ViewState
    Turn on HTTP compression on the server (IIS)
    Compress the ViewState
    Store the ViewState on the server

    Take a look at Understanding ASP.NET View State

    Best Regards,

    Chris Zhao

    Wednesday, January 20, 2016 8:38 AM
  • User-219456107 posted

    Please note my original question: "How is this being added to the viewstate? EnableViewState="False" is set on the ListView and also on the control."

    Monday, February 1, 2016 5:54 PM
  • User465171450 posted

    As was already mentioned, controls can actually over-ride that. Starting with ASP.Net 2.0, the concept of a control-state entered into the environment. Controls can save state necessary even if you tell them not to. I would guess one of the parent controls does have viewstate enabled, though in some cases ASP.Net knows it's useless to turn it off as that prevents certain functionality from working.

    Thursday, February 4, 2016 4:30 AM
  • User-219456107 posted

    I've changed the control and the parent repeater from EnableViewState = False to ViewStateMode = Disabled to no avail.

    Saturday, February 6, 2016 10:52 PM