When applying a custom master page to our SharePoint site, we struck an issue with opening Nintex forms.
Sorry, something went wrong
An unexpected error has occurred.
Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
After a bit of digging around with ULSviewer, we found this error in the SharePoint Log
Application error when access /site/Lists/ourlist/DispForm.aspx, Error=The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
at System.Web.UI.ControlCollection.Add(Control child)
at Nintex.Workflow.Forms.ControlTemplates.ListForm.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at Microsoft.SharePoint.WebPartPages.ListFormWebPart.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at Microsoft.SharePoint.WebPartPages.WebPart.get_WebPartMenu()
at Microsoft.SharePoint.WebPartPages.ListFormWebPart.CreateWebPartMenu()
at Microsoft.SharePoint.WebPartPages.ListFormWebPart.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The problem was definitely master page related, because it didn’t occur when we switched back to the default SharePoint master page.
The solution:
In the custom master page, look for the following code.
Move this code block from the Header in to the Body of the master page
<!–MS:<SharePoint:AjaxDelta id=”DeltaSPWebPartManager” runat=”server”>–>
<!–MS:<WebPartPages:SPWebPartManager runat=”server”>–>
<!–ME:</WebPartPages:SPWebPartManager>–>
<!–ME:</SharePoint:AjaxDelta>–>
Try opening the Nintex form again and with any luck your error will go away.
I believe this issue happens because Nintex forms ignore the header part of the master page. Someone with more developer knowledge than me might be able to explain further.
[Updated]
The HTML master page SPWebPartManager position can also be part of the problem. Make sure this is positioned in the <body> section too. I noticed that if this was in the wrong place, it could cause the error above for all users except Site Collection Admins.
See the reference section of this MSDN article for an example of correctly format HTML
How to: Convert an HTML file into a master page in SharePoint 2013