"Cannot load ViewState" after dynamic control changed

Posted by Emil D on Stack Overflow See other posts from Stack Overflow or by Emil D
Published on 2010-04-28T15:22:56Z Indexed on 2010/04/28 15:33 UTC
Read the original article Hit count: 237

In my ASP.NET page I have to dynamically choose and load a custom control, depending on the selected value in a dropdownlist.However I encountered the following problem: When the parameters of the dynamically loaded control are changed, and then the selection in the dropdownlist is changed( thus forcing me to load a different dynamic control the next time the page reloads ), I end up with a "Cannot load ViewState" exception.I assume that this happens because the ViewState is trying to restore the parameters of the old control and it doesn't find it. So , is there any way to stop the viewstate from attempting to restore the state of the non-existig control?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#