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
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