Loading...

“The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.”

Title

“The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.”

Description

“The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.”

Please wait...
After upgrading an environment from 2010 to 2013 via DB detach/attach (uninstalling QuickApps before the dettach and installing the correct version after the attach), on any page with QA or when trying to add a Web Part, the following error is thrown:
"Exception Details: System.Web.HttpException: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below."
If you create a new Web Part page and add an OOB SharePoint web part, everything works. The Configuration Editor has been run and the web.config is correctly modified.

Cause

The SPWebPartManager control of the Site's Master page is in the wrong section.

Resolution

WORKAROUND:
1) Use SharePoint Designer to open the Site 
2) Go to the Site's Master Pages
3) Edit the Master page used by the Web Part pages. By default, it is seattle.master. Make sure you edit the CORRECT Master page (create a backup of the page before modification)
4) Search for the SPWebPartManager control by its ID as seen below:
<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">
    <WebPartPages:SPWebPartManager runat="Server"/>
</SharePoint:AjaxDelta>
5) If this control is in the <HEAD> section you move it to the <BODY> section. Save the Master page.

Defect ID

The SPWebPartManager control of the Site's Master page is in the wrong section.

Leave a Reply