Failed to load viewstate

M

Mattias Sundström

Hi!

I have an annoying problem concerning viewstate in dynamically loaded user
controls. I have a menu and a placeholder on an aspx page. The menu uses
AsyncPostbackTriggers to call the serverside for loading the controls. The
placeholder contains an updatepanel in which the controls are loaded. When I
click the menu I load the control using the LoadControl() method. After the
LoadControl() method I clear the Updatepanel and add the control to its
ContentTemplateContainer.

UserControl myControl = (UserControl)LoadControl(control);

UserControlPanel.ContentTemplateContainer.Controls.Clear();

UserControlPanel.ContentTemplateContainer.Controls.Add(myControl);


And sometimed, not always and not even regularly, I get an error that says
"Failed to load viewstate..." when I do the call to controls.add() on the
ContentTemplateContainer. I guess that something in the load procedure for
the control is not finished, because when I step through the code and let
some time go between each call there's no problem.

Someone who can help me? :)

Would be very happy if someone could!

/Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top