Failed to load View State in SharePoint Solution

When I tried to upgrade ASP.Net solution to SharePoint solution. I got the following error:

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

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


Solution

The simplest way is

  • Disable “ViewState for a specific control or
  • Disable “ViewStatefor the whole user control as shown below:

Disable View State in SharePoint

Note:  don’t add different kinds of User Controls to the same placeholder at the same location. it’s recommended to add each User Control at an Indepenedt Placeholder


 

Advertisements