ASPX templates
Version 6.x > ASPX templates > Error Message: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload View modes: 
User avatar
Member
Member
ldowdell - 4/12/2012 9:47:03 AM
   
Error Message: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload
When adding a webpart to my ASPX page using the Portal Engine functionality, if I enabled the Ajax/Update Panel feature I kept getting the error message: "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload..."

Since I was using a webpart that was pre-built modifing the code so that it didn't display any content on the Design tab wasn't working (as referenced on http://devnet.kentico.com/docs/devguide/index.html?developing_web_parts.htm).

After going back and forth with a patient support guru (Thanks Radek!) I realized I had placed my ajaxToolkit control in the wrong place on my masterpage -- it should have been at the top with the cms:CMSPortalManager, whereas I had it at the bottom of the page.
<asp:PlaceHolder runat="server" ID="plcManagers">
<cms:CMSPortalManager ID="manPortal" runat="server" EnableViewState="false" />
<ajaxToolkit:ToolkitScriptManager ID="manScript" runat="server" EnableViewState="false"
ScriptMode="Release" />
</asp:PlaceHolder>

I am submitting this to provide a solution for Ajax-newbies like myself who might not have known this. Awkward!

User avatar
Member
Member
abdulqadir-khayal - 10/24/2012 4:38:34 AM
   
RE:Error Message: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload
Thanks ldowdell

it works like a charm.love you

User avatar
Certified Developer v7
Certified  Developer v7
maxg - 12/20/2012 3:22:23 PM
   
RE:Error Message: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload
Hi - thanks for posting

Any idea why you need the wrapping Placeholder?

It breaks without it...

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 12/21/2012 4:19:00 AM
   
RE:Error Message: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload
Hi,

You can find the explanation in our Developers Guide - Creating ASPX master pages.Where you can read that Master pages must always contain one or more ContentPlaceHolder controls because...
The ContentPlaceHolder control specifies where child pages display their content inside the master page.

Best regards,
Martin Danko