Copied to clipboard

Flag this post as spam?

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


  • Justin Spradlin 139 posts 347 karma points
    Nov 04, 2011 @ 19:42
    Justin Spradlin
    0

    Data Bind Style Sheet Path with Client Dependency Framework

    Hi,

    I have a theme that I am html theme that I am converting to master pages for my umbraco site. I added a top level "Site Settings" document type that has a drop down list property called "ThemeStyle". I have successfully created the drop down list with values like "Red", "Blue", "Green". 

    To change the theme color, you simply include /css/colors/STYLENAME.css, where STYLENAME is the value from the ThemStyle property on my Site Settings node. I now want to update my Main.master page to dynamically include this style sheet using the client dependency framework but I can't seem to get it to work, all of my non data bound scripts/styles load correctly. 

    I tried this and it does not work (ignore the fact that I am hard-coding the "colors/red.css" for now)

    <CD:CssInclude runat="server" FilePath='<%# "colors/red.css" %>' Priority="30" PathNameAlias="Styles" />

    I even tried to call this during Page_Load for the master page.

    ClientDependencyLoader.Instance.DataBind();

    This code works fine

     

    <CD:CssInclude runat="server" FilePath='colors/red.css' Priority="30" PathNameAlias="Styles" />

     

    Does anyone know how to do this? Also, assuming that we get this working, how would I get the "ThemeStyle" value to databind to assuming that it is on the top level node of my web site?

     

    Thanks in advance,

     

    Justin

  • Justin Spradlin 139 posts 347 karma points
    Nov 04, 2011 @ 19:47
    Justin Spradlin
    0

    I don't know why I can't edit my post, but I meant to say:

    I have a new html them that I am converting to masterpages instead of I have a theme that I am html theme that I am converting to master pages

     

Please Sign in or register to post replies

Write your reply to:

Draft