Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 04, 2011 @ 16:10
    Jeavon Leopold
    0

    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?

    <CD:CssInclude ID="CssInclude1" runat="server" FilePath="/css/structure.css" />
    <CD:CssInclude ID="CssInclude2" runat="server" FilePath="/Css/pageDisplay.css" />
    

    Works fine, but change to:

    <CD:HtmlInclude runat="server"> 
    <link href="/css/structure.css" rel="stylesheet" type="text/css" /> 
    <link href="/css/pageDisplay.css" rel="stylesheet" type="text/css" />
    </CD:HtmlInclude>  

    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

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 05, 2011 @ 11:18
    Jeavon Leopold
    0

    I have just tried upgrading Client Dependency to latest 1.4 beta version, but still same error.

    Anyone with any ideas?

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 01:48
    Shannon Deminick
    0

    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?

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 09:41
    Sherry Ann Hernandez
    0

    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?

     

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 09:49
    Shannon Deminick
    0

    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.

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 10:00
    Sherry Ann Hernandez
    0

    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. <% ... %>).

     

    ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider.RegisterDependencies(Control dependantControl, String js, String css) +274
       System.Collections.Generic.List`1.ForEach(Action`1 action) +64

     

     

     

     On my previous post I put the <umb:UmbracoClientDependencyLoader runat="server" ID="ClientLoader" /> before the css tag.

     

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 10:03
    Shannon Deminick
    0

    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.

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 10:15
    Sherry Ann Hernandez
    0

    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. <% ... %>).

     

     

    ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider.RegisterDependencies(Control dependantControl, String js, String css) +274
       System.Collections.Generic.List`1.ForEach(Action`1 action) +64

     

     

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:20
    Jeavon Leopold
    0

    Hi Shannon,

    Welcome back from holiday!

    Just tried a standalone aspx file in the umbraco folder and got the same error?

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    <CD:HtmlInclude ID="HtmlInclude1" runat="server"> 
    <link href="/css/structure.css" rel="stylesheet" type="text/css" /> 
    <link href="/css/pageDisplay.css" rel="stylesheet" type="text/css" />
    </CD:HtmlInclude>  
    
    <CD:ClientDependencyLoader runat="server" id="Loader" >
    <Paths>
    <CD:ClientDependencyPath Name="Styles" Path="~/css" />
    <CD:ClientDependencyPath Name="Scripts" Path='~/scripts' />
    </Paths>
    </CD:ClientDependencyLoader>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
    
        </div>
        </form>
    </body>
    </html>
    
    Thanks!
  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:22
    Jeavon Leopold
    1

    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

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 10:23
    Shannon Deminick
    0

    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.

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 10:25
    Sherry Ann Hernandez
    0

    @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.

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:28
    Jeavon Leopold
    0

    It doesn't make any difference where the CD controls are located, still get the same error, e.g.

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="CD" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
    </head>
    
    
    <body>
    <form id="form1" runat="server">
    
    <CD:HtmlInclude ID="HtmlInclude1" runat="server"> 
    <link href="/css/structure.css" rel="stylesheet" type="text/css" /> 
    <link href="/css/pageDisplay.css" rel="stylesheet" type="text/css" />
    </CD:HtmlInclude>  
    
    <CD:ClientDependencyLoader runat="server" id="Loader" >
    <Paths>
    <CD:ClientDependencyPath Name="Styles" Path="~/css" />
    <CD:ClientDependencyPath Name="Scripts" Path='~/scripts' />
    </Paths>
    </CD:ClientDependencyLoader>
        <div>
    
        </div>
        </form>
    </body>
    </html>
  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 10:31
    Shannon Deminick
    0

    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 ?

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:34
    Jeavon Leopold
    0

    Shannon, I am not forcing and my default provider is LoaderControlProvider?

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Aug 09, 2011 @ 10:41
    Shannon Deminick
    0

    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.

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:42
    Jeavon Leopold
    0

    Sheery, have you checked you have useLegacyRenderMethods="true" on your root node in ClientDependency.config? That got rid of the backoffice issues for me.

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 10:49
    Sherry Ann Hernandez
    0

    @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. :(

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:50
    Jeavon Leopold
    0

    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 :-) 

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 10:53
    Jeavon Leopold
    0

    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.

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 10:59
    Sherry Ann Hernandez
    0

    @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.

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 11:17
    Jeavon Leopold
    1

    That is strange! Here is how we have it working fine.

    <CD:CssInclude ID="CssInclude2" runat="server" FilePath="/css/structure.css" /> 
    <CD:JsInclude ID="JsInclude1" runat="server" FilePath="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js" Priority="1" />
    <CD:JsInclude ID="JsInclude2" runat="server" FilePath="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js" Priority="2" />  
    <CD:JsInclude ID="JsInclude4" runat="server" FilePath="/scripts/jquery.cycle.all.js" Priority="3" />  
    
    <CD:ClientDependencyLoader runat="server" id="Loader" >
    <Paths>
    <CD:ClientDependencyPath Name="Styles" Path="~/css" />
    <CD:ClientDependencyPath Name="Scripts" Path='~/scripts' />
    </Paths>
    </CD:ClientDependencyLoader>
  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 11:31
    Sherry Ann Hernandez
    0

    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?

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 12:52
    Jeavon Leopold
    0

    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

     

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 09, 2011 @ 13:25
    Sherry Ann Hernandez
    0

     

    are you getting the same error?

    I try to use the files that you've shared but this error is still persisting. Really weird.

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 09, 2011 @ 13:31
    Jeavon Leopold
    0

    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?

  • Sherry Ann Hernandez 320 posts 344 karma points
    Aug 10, 2011 @ 07:43
    Sherry Ann Hernandez
    0

    yep i'm using umbraco 4.7 and the umbracodebugmode is already set to false.

  • Jeavon Leopold 3073 posts 13630 karma points MVP 11x admin c-trib
    Aug 11, 2011 @ 11:11
    Jeavon Leopold
    0

    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?

  • Anthony Candaele 1197 posts 2049 karma points
    Oct 23, 2012 @ 14:27
    Anthony Candaele
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft