ASPX templates
Version 7.x > ASPX templates > Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases." View modes: 
User avatar
Member
Member
seanbun - 2/10/2013 11:58:46 PM
   
Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
I am developing a new website on v7.0.16 with ASPX templates

After I applied a default workflow on the document tree, I got the error message "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases." on the Edit page screen in the CMSDesk. It only happened when the workflow was on.


I followed the developer guide and use the ajax tool kits and portal manager in the master page. If I used a Pagemanager instead of PortalManager. it worked fine and issue did not come up. However, the "save" and "cancel" button for the editable region disappear.
<ajaxToolkit:ToolkitScriptManager ID="manScript" runat="server" EnableViewState="false" ScriptMode="Release" />
<cms:CMSPortalManager ID="CMSPortalManager1" runat="server" EnableViewState="false" />

Let me know if you want some more information.

Cheers,
Matt

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/11/2013 1:10:03 AM
   
RE:Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
Hi,

This thread may help as well as this article.

To show the save buttons, please add this control to your master page template:
<cms:ContextMenuPlaceHolder ID="plcCtx" runat="server" />

Best regards,
Juraj Ondrus

User avatar
Member
Member
seanbun - 2/11/2013 4:04:50 PM
   
RE:Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
Hi Juraj,

Thanks for your quick reply. I have read the thread but it does not help. I tried to remove all my custom code on the templates but error still throws. I wonder if there is a bug in the portalmanager when workflow is on.

Also, I tried to the place the contextmenuplaceholder to the masterpage right under the ToolKitScriptManager control. But the save button does not show. :(

User avatar
Member
Member
seanbun - 2/11/2013 4:35:39 PM
   
RE:Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
I have two more findings.

1. Without the ContextMenuPlaceHolder, the "the control collection" error throws only at the "edit" and "published" status but not "archive".

2. This issue could be resolved when I use CMSPortalManager with contextMenuPlaceHolder. Using old CMSPageManager and contextmenuplaceholder would still miss the "Save" Button. So, should we always put the ContextMenuPlaceHolder control in the master page? or is this just a workaround?
<cms:ContextMenuPlaceHolder ID="plcCtx" runat="server" />

Thank you.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/12/2013 1:53:02 AM
   
RE:Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
Hi,

CMSPageManager is obsolete. You should use the CMSPortalManager together with contextMenuPlaceholder control, which is displaying the edit action buttons. Please see the default master page for the sample ASPX templates and take inspiration from it.

Best regards,
Juraj Ondrus

User avatar
Member
Member
pindi_johal-hotmail - 5/24/2013 1:01:34 PM
   
RE:Workflow and Error "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
I have gotten my site working. In my *.master page, I originally had:

<ajaxToolkit:ToolkitScriptManager ID="manScript" runat="server" />
<cms:CMSPortalManager ID="manPortal" ShortID="m" runat="server" EnableViewState="false" />

Then I looked at the PortalTemplate.aspx file and made the change to my *.master file:

<asp:PlaceHolder runat="server" ID="plcManagers">
<ajaxToolkit:ToolkitScriptManager ID="manScript" runat="server" ScriptMode="Release" EnableViewState="false" />
<cms:CMSPortalManager ID="manPortal" ShortID="m" runat="server" EnableViewState="false" />
<cms:CMSDocumentManager ID="docMan" ShortID="dm" runat="server" StopProcessing="true" Visible="false" IsLiveSite="false" />
</asp:PlaceHolder>
<cms:ContextMenuPlaceHolder ID="plcCtx" runat="server" />

Looks like I do not need the CMSDocumentManager, but I kept it for now until I can see there is no purpose of it for me, as using the Basic Publishing workflow works fine now.