Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Failed to load viewstate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sanjay Pais - 20 May 2008 22:20 GMT
We keep getting this error on one of our web pages. I have absolutely no
idea which control is causing the problem. How do i diagnose and fix this
problem?

It has been driving us nuts!

Thanks

Sanjay

System.Web.HttpException: 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(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)

  at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)

  at System.Web.UI.Page.LoadAllState()

  at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Cowboy (Gregory A. Beamer) - 20 May 2008 22:26 GMT
Essentially, the framework pulls the viewstate and starts matching controls
to their viewstate values. You might then have new values from the submit,
which overrides these values. Then viewstate is reset.

By design, it fails if it has a value that does not match a control. This is
most common with dynamically added controls. That leads to this question:

Are you using dynamically added controls? If so, you have to place them on
the page before ViewState is pulled by the CLI ... IF they use viewstate on
these controls, that is.

Signature

Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************

| Think outside the box!

*************************************************
> We keep getting this error on one of our web pages. I have absolutely no
> idea which control is causing the problem. How do i diagnose and fix this
[quoted text clipped - 62 lines]
>   at System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
bruce barker - 20 May 2008 23:49 GMT
generally this happens when on postback, controls do not get the same id as
on the original render. this is caused by having server controls with no id
specified (so the id is generated). then postback logic causes the controls
to be created in a different order, so the ids do not match the render ids.

check for <% if %> on the asp page

-- bruce (sqlwork.com)

> We keep getting this error on one of our web pages. I have absolutely no
> idea which control is causing the problem. How do i diagnose and fix this
[quoted text clipped - 62 lines]
>    at System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.