471,310 Members | 1,083 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Failed to load viewstate error

Hi,

We have an ASP.net application, where we dynamically add controls, in the
Page_Load. Occasionally, when the user posts back the page (e.g. clicks Save
button on the page), we get a "Failed to load viewstate" error. This happens
on Windows Server 2003. It happens erratically, and appears to happen after
the application has been running (and in use) for some time. When the
problem arises, it appears to happen more frequently for a while, then
everything works perfectly for another long period...and so on.

We have not been able to re-produce the error on an XP pc yet (so not sure
if it is OS dependant, or some other issue).

The dynamically-added controls are always added in the same order, in the
Page_Load.

Any suggestions would be much appreciated.

Regards,

Eamonn.


Jul 21 '05 #1
3 2772
Hi Eamonn,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're getting a "Failed to load
viewstate" error occasionally. If there is any misunderstanding, please
feel free to let me know.

Based on my research, this error might occur when you have some 3rd-party
control on the ASP.NET page. So could you let me know what version of
ASP.NET you're using and what control you're adding dynamically?

Thanks.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Hi Kevin,

Yes, we are getting a "Failed to load viewstate" error occasionally.
The exact error is as follows:

Failed to load viewstate. The control tree into which viewstate is being
loaded must match the control tree that was used to save viewstate during
the previous request. For example, when adding controls dynamically, the
controls added during a post-back must match the type and position of the
controls added during the initial request.
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.ControlCollection.Add(Control child)
at OC_WebControls.TocControlContainer.CreateControls( ResourceManager
LocRM, WebControlFactory ControlFactory, DataRow[] Rows, Hashtable
htParentControls)
at Jupiter.RunTimeForm.ConstructFormView(DataSet dsScreenDefinition)
at Jupiter.RunTimeForm.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

There are many controls on the form, mostly dot net controls including
textboxes, labelse, checkboxes, htmlimage, hidden field, combo, etc...but
also UltraWebGrig and UltraWebTab from Infragistics.
The problem is diffiult to reproduce using the debug version of the
application so we havn't pin pointed which control has the problem. (I will
put in a try...catch which throws an error idenitifying the control name and
test a 'Release' version.)

The problem arrises after the site has been used for some time, then
frequently occurrs, then disappears for a long time, only to reappear later.

We are using .Net Framework version 1.1.4322

Any assistance you can provide is appreciated.
Regards,
Eamon.

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:B4**************@TK2MSFTNGXA01.phx.gbl...
Hi Eamonn,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you're getting a "Failed to load
viewstate" error occasionally. If there is any misunderstanding, please
feel free to let me know.

Based on my research, this error might occur when you have some 3rd-party
control on the ASP.NET page. So could you let me know what version of
ASP.NET you're using and what control you're adding dynamically?

Thanks.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
Hi Eamonn,

Thanks for your reply. This error seems to have something to do with the
UltraWebGrid. I have found similar issue using this control and get the
same problem as you do.

To isolate the problem, we can try to remove the 3rd-party control and see
if the problem can be reproed. I would suggest you try to contact the
control vendor to see if there is a workaround. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by John Kirksey | last post: by
1 post views Thread by et | last post: by
1 post views Thread by Tim | last post: by
3 posts views Thread by Eamonn O'Connell | last post: by
1 post views Thread by rockdale | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.