ASP.NET - this is my error - Asked By Bala Marish on 01-Aug-12 07:13 AM

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.


what is the problem on my page ,any postback event the above error will occur.
Danasegarane Arunachalam replied to Bala Marish on 01-Aug-12 08:57 AM
The below blog explains the root causes for the problem and tell the action for solving the problem

http://blogs.msdn.com/b/asiatech/archive/2011/10/25/why-we-get-the-exception-failed-to-load-viewstate.aspx
Peter Bromberg replied to Bala Marish on 01-Aug-12 12:55 PM
The message is really quite clear. If your code creates any controls dynamically, then it must recreate those controls on a postback in order for ViewState to be successfully applied.