Failed to load viewstate.

P

polabear

I get this error message:

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.

When I do pastback for a page with a lot of controls that are dynamically
added to a placeholder control. Would anybody know what I'm doing wrong?

Thanks for any suggestions,
sverres
 
R

Robert Haken [MVP]

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.

When I do pastback for a page with a lot of controls that are dynamically
added to a placeholder control. Would anybody know what I'm doing wrong?

You have to rebuild whole control-tree on every request (including
postbacks), and you have to do it before LoadViewState stage of page
lifecycle - usually in Init stage.

Robert Haken [MVP ASP/ASP.NET]
HAVIT, s.r.o., www.havit.cz
http://knowledge-base.havit.cz
 

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

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top