The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases. at System.Web.UI.ControlCollection.Add(Control child) at ClientDependency.Core.Controls.HtmlInclude.OnInit(EventArgs e)
I think its because wherever this declaration exists (i.e. User control) it is getting put together by Umbraco somewhere and is done in the Init or Prerender phases...
Can you try just using the same declaration in a standard aspx page outside of Umbraco?
Where are you declaring this? And do you mean to ForceProviders ?
Also, you are referencing CDN locations, are you using the latest 1.4 beta? If not, please be aware that your webserver will merely download those files from the CDN and serve them from itself... meaning that the CDN doesn't get used. 1.4 beta will ensure the CDN is used.
I read in other post that this will ensure that the css will be rendered at the top and my scripts at the bottom of the page.
I try to use the 1.4 beta but I'm getting a script error on my back office whenever I try to update the ClientDependency.Core.dll and the ClientDependency.config. I can't save any of my templates/documents.
Now I have a different error
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Dont put any of the client dependency tags in your actual header.
If you want your scripts at the bottom and css at the top, then you would put your dependency loader at the bottom where you want your scripts to render, then don't force providers on your scripts and use ForceProvider="PageHeaderProvider" for your CSS, which will put your css into the header on output.
Make sure you don't put the Client Dependency controls inside your header, that is probably the cause of the issue since it's already in your header, and its dynamically trying to modify controls inside the header as well.
Perhaps the HtmlInclude control had not been used/tested before with the PageHeaderProvider before, might ask Matt B. If you change the default provider to the loader control provider and not force any page header providers does it work ?
Pretty sure there's a test in the web test project in the CDF source that does this, will have to have a look but wont be till later this week. By all means get the source and run the test web proj... pretty sure there's a test that uses this control.
Sheery, have you checked you have useLegacyRenderMethods="true" on your root node in ClientDependency.config? That got rid of the backoffice issues for me.
It's included in the config changes that you provided with wiki right? I just copy the whole config. Regarding your issue, your are encountering the problem whenever you use the htmlinclude, but the clientdependency works fine if you use the usual cssinclude and jsinclude? because mine is not working at all. :(
Shannon, thats cool, will take a look at the source code. Not a big problem anyway, would be nice to use the HtmlInclude control, but it's not exactly the end of the world having individual JsInclude and CssInclude :-)
Sheery, yes it works fine with the standard controls. Make sure you have downloaded the 1.4 beta dll because using v 1.3.2 also gives you the back office issues.
Can you show me how you use it using the standard controls?
This is getting crazy. I copied the dll mentioned in the wiki and change the config files but still same error in the back office and my website is not working.
How do I know if I use the 1.4 beta dll? I view the file properties and it is showing that the assembly is 1.3.2 but the download link that I use is http://clientdependency.codeplex.com/releases/view/67932 which i'm sure is referencing to the 1.4 beta
Is there other settings in the iis do I need?
I remove the forceprovider in the cssinclude but it seems that my css are not rendered as you can see here in this url http://admin.flora-group.com/
The assembly version shows as 1.3.1.0 for the 1.4 beta. There is a link below to a zip file with both the dll and config file that I have working, give that a try? (make sure you unblock once you have downloaded if using Windows 7)
Client Dependency CD:HtmlInclude giving YSOD
Hi,
I'm trying to use the cool HtmlInclude registration method for Client Dependency but I am gettting a YSOD when using it?
Works fine, but change to:
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
at System.Web.UI.ControlCollection.Add(Control child)
at ClientDependency.Core.Controls.HtmlInclude.OnInit(EventArgs e)
Any ideas?
Thanks,
Jeavon
I have just tried upgrading Client Dependency to latest 1.4 beta version, but still same error.
Anyone with any ideas?
Where are you putting this declaration?
I think its because wherever this declaration exists (i.e. User control) it is getting put together by Umbraco somewhere and is done in the Init or Prerender phases...
Can you try just using the same declaration in a standard aspx page outside of Umbraco?
Hi
I also have this code in my page but it is also giving me an error of
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
<umb:UmbracoClientDependencyLoader runat="server" ID="ClientLoader" />
<CD:CssInclude ID="CssInclude1" runat="server" FilePath="css/base.css" ForceProvider="PageHeaderProvider" />
<CD:CssInclude ID="CssInclude2" runat="server" FilePath="http://cdn.objects.flora-group.com/css/jquery.fancybox-1.3.2_min.css" ForceProvider="PageHeaderProvider"/>
<CD:CssInclude ID="CssInclude3" runat="server" FilePath="http://cdn.objects.flora-group.com/css/jquery-ui-1.8.6.custom_min.css" ForceProvider="PageHeaderProvider" />
<CD:CssInclude ID="CssInclude4" runat="server" FilePath="http://cdn.objects.flora-group.com/css/ie7.css" ForceProvider="PageHeaderProvider"/>
What am I doing wrong?
Where are you declaring this? And do you mean to ForceProviders ?
Also, you are referencing CDN locations, are you using the latest 1.4 beta? If not, please be aware that your webserver will merely download those files from the CDN and serve them from itself... meaning that the CDN doesn't get used. 1.4 beta will ensure the CDN is used.
The css are inside the head section and then below I have this code
<cd:JsInclude ID="JsInclude1" runat="server" FilePath="http://cdn.objects.flora-group.com/scripts/jquery-ui-1.8.6.custom_group.min.js" Priority="0" />
<umb:UmbracoClientDependencyLoader runat="server" ID="ClientLoader" />
I read in other post that this will ensure that the css will be rendered at the top and my scripts at the bottom of the page.
I try to use the 1.4 beta but I'm getting a script error on my back office whenever I try to update the ClientDependency.Core.dll and the ClientDependency.config. I can't save any of my templates/documents.
Now I have a different error
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
On my previous post I put the <umb:UmbracoClientDependencyLoader runat="server" ID="ClientLoader" /> before the css tag.
Dont put any of the client dependency tags in your actual header.
If you want your scripts at the bottom and css at the top, then you would put your dependency loader at the bottom where you want your scripts to render, then don't force providers on your scripts and use ForceProvider="PageHeaderProvider" for your CSS, which will put your css into the header on output.
But in umbraco.aspx all the client dependency is inside the head section?
this is my code at the bottom of the page now
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<cd:CssInclude ID="CssInclude1" runat="server" FilePath="css/base.css" ForceProvider="PageHeaderProvider" />
<cd:CssInclude ID="CssInclude2" runat="server" FilePath="http://cdn.objects.flora-group.com/css/jquery.fancybox-1.3.2_min.css" ForceProvider="PageHeaderProvider"/>
<cd:CssInclude ID="CssInclude3" runat="server" FilePath="http://cdn.objects.flora-group.com/css/jquery-ui-1.8.6.custom_min.css" ForceProvider="PageHeaderProvider" />
<cd:CssInclude ID="CssInclude4" runat="server" FilePath="http://cdn.objects.flora-group.com/css/ie7.css" ForceProvider="PageHeaderProvider"/>
<cd:JsInclude ID="JsInclude1" runat="server" FilePath="http://cdn.objects.flora-group.com/scripts/jquery-ui-1.8.6.custom_group.min.js" Priority="0" />
<umb:UmbracoClientDependencyLoader runat="server" ID="ClientLoader" />
<asp:ContentPlaceHolder ID="headScript" runat="server">
</asp:ContentPlaceHolder>
</body>
But this is still giving me the error
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Hi Shannon,
Welcome back from holiday!
Just tried a standalone aspx file in the umbraco folder and got the same error?
Hi Sherry,
I posted a Wiki about how to upgrade to Client Dependency 1.4 beta which you need for using CDN hosted files.
http://our.umbraco.org/wiki/how-tos/upgrade-umbraco-to-latest-client-dependency-framework
Regards,
Jeavon
Make sure you don't put the Client Dependency controls inside your header, that is probably the cause of the issue since it's already in your header, and its dynamically trying to modify controls inside the header as well.
@Jeavon,
I already tried that but I'm getting a script error in my back office whenever I try update the clientdependency.core.dll
@Shannon
I already remove it from the header but I'm still getting an error.
It doesn't make any difference where the CD controls are located, still get the same error, e.g.
Perhaps the HtmlInclude control had not been used/tested before with the PageHeaderProvider before, might ask Matt B. If you change the default provider to the loader control provider and not force any page header providers does it work ?
Shannon, I am not forcing and my default provider is LoaderControlProvider?
hrm, well thats no good :)
Pretty sure there's a test in the web test project in the CDF source that does this, will have to have a look but wont be till later this week. By all means get the source and run the test web proj... pretty sure there's a test that uses this control.
Sheery, have you checked you have useLegacyRenderMethods="true" on your root node in ClientDependency.config? That got rid of the backoffice issues for me.
@Jeavon
It's included in the config changes that you provided with wiki right? I just copy the whole config. Regarding your issue, your are encountering the problem whenever you use the htmlinclude, but the clientdependency works fine if you use the usual cssinclude and jsinclude? because mine is not working at all. :(
Shannon, thats cool, will take a look at the source code. Not a big problem anyway, would be nice to use the HtmlInclude control, but it's not exactly the end of the world having individual JsInclude and CssInclude :-)
Sheery, yes it works fine with the standard controls. Make sure you have downloaded the 1.4 beta dll because using v 1.3.2 also gives you the back office issues.
@Jeavon,
Can you show me how you use it using the standard controls?
This is getting crazy. I copied the dll mentioned in the wiki and change the config files but still same error in the back office and my website is not working.
That is strange! Here is how we have it working fine.
How do I know if I use the 1.4 beta dll? I view the file properties and it is showing that the assembly is 1.3.2 but the download link that I use is http://clientdependency.codeplex.com/releases/view/67932 which i'm sure is referencing to the 1.4 beta
Is there other settings in the iis do I need?
I remove the forceprovider in the cssinclude but it seems that my css are not rendered as you can see here in this url http://admin.flora-group.com/
Why is that?
The assembly version shows as 1.3.1.0 for the 1.4 beta. There is a link below to a zip file with both the dll and config file that I have working, give that a try? (make sure you unblock once you have downloaded if using Windows 7)
https://rcpt.yousendit.com/1190687433/5c79a85ce1f4b3682e498ca4841d118c
are you getting the same error?
I try to use the files that you've shared but this error is still persisting. Really weird.
Nope, no errors showing here, are you using Umbraco 4.7? One thought, have you set debug=false in the compilation node in web.config?
yep i'm using umbraco 4.7 and the umbracodebugmode is already set to false.
I meant compilation, e.g.
<compilation defaultLanguage="c#" debug="true" batch="false" targetFramework="4.0">
If you rollback the clientdependency dll and the config file does the back office work correctly again?
Thanks Jeavon,
Setting the Priority attribute on my CD:JsInclude element got my Nivo Slider working with Client Dependency (see my forum post Nivo slider not working after implementing Client Dependency Framework)
Thanks a lot,
Anthony
is working on a reply...