+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Can't get CssFileLink to work

Can't get CssFileLink to work

9 posts, 0 answered
  1. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    29 May 2009
    Link to this post
    I've used this control before, but I don't know if things have changed with ver. 3.6 (I'm in the process of upgrading to 3.6).  I have a modified version of the Events Insert and Events Edit controls (for adding and modifying events in the admin interface).  I have mapped these controls and the customized content of these controls is being pulled up properly in Sitefinity, so I know taht the template mapping works fine.  But I can't get the custom CSS to work.  I added the following at the top of my EventsItemNew.ascx and EventsItemEdit.ascx controls:

    <telerik:CssFileLink ID="CssFileLink1" FileName="~/Sitefinity_Custom/Admin/ControlTemplates/Events/eventsCustomizations.css" Media="screen" runat="server" /> 

    But the CSS doesn't get applied (nor do I see the reference to eventsCustomizations.css in the HEAD of the rendered HTML).

    Am I doing something wrong?

    Also, I know that in the past, this control used to be placed as <sfWeb:CssFileLink...  Is <telerik:CssFileLink the same control, basically, or are they different somehow?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 May 2009
    Link to this post
    Hello Marko,

    Are you getting any errors related to the tag prefix. Check whether the assemble and the namespace are
    Assembly="Telerik.Cms.Web.UI" and Namespace="Telerik.Cms.Web.UI"

    Also, I know that in the past, this control used to be placed as <sfWeb:CssFileLink...  Is <telerik:CssFileLink the same control, basically, or are they different somehow?


    The tag prefix is different. Check out the code below and give a try to it.

    Sample code:

    <%@ Register TagPrefix="sf" Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" %> 
     
    <sf:CssFileLink ID="CssFileLink1" runat="server" Media="sereen" FileName="~/somefile" /> 

    Let us know the result.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    29 May 2009
    Link to this post
    I'm not getting any errors.  I tried your code, and nothing happens.  What's weird is that, even if I purposely misspell something in the properties, it still doesn't complain about anything.

    For example, if I use this:

    <sf:CssFileLink ID="CssFileLink1" runat="server" Media="screen" FileName="~/nonExistentFile.css" />  

    The page will load just fine, no errors.  Is that suggestive of something being buggy with the CssFileLink control, or is it simply not going to report if the specified file cannot be found?
  4. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    01 Jun 2009
    Link to this post
    Hi Marko,

    Actually, since you want to change the backend part of Events, you can't use the CssFileLink property - it is good only for the public control templates.

    What you need to modify are the css files in the following path:
    ~/Sitefinity/Admin/Themes/Default/
    such as Modules.css

    This is because the styles are generated dynamically based on the current page in the administration area.

    Hope this helps. Let us know if you need further assistance.

    Regards,
    Sonya
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    01 Jun 2009
    Link to this post
    Ah, I see.  Didn't know that I can't use CssFileLink for the backend stuff.

    I can modify the styles in their original location, sure, but I was hoping to be able to have my custom styles in a special location, or something, so that they don't get affected by future Sitefinity updates.  Is there a way for me to reference css styles for the backened, WITHOUT modifying the original styles in ~/Sitefinity/Admin/Styles/Default... ? 
  6. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    02 Jun 2009
    Link to this post
    Hello Marko,

    Unfortunately, there isn't a way to do define that in the backend control templates. What you can do instead is import your custom css file into the built-in css files.

    For example, here is how you can add your file in the Modules.css file:

    Modules.css:
    @import url(MyCustomCssFile.css); 
    @import url(reset.css); 
    @import url(global1.css); 
    .generic .mainForm h3 label,.News .mainForm h3 label, .Blogs .mainForm h3 label, .Forums .mainForm h3 label, .Libraries .mainForm h3 label, .Events .mainForm h3 label, .Newsletters .mainForm h3 label, .poll .mainForm h3 label, .Showcases .mainForm h3 label {float:none;width:auto;text-align:left
    .generic div.title input, .News div.title input, .Blogs div.title input, .Forums div.title input, .poll div.title input {font-size:18px;width:500px;border:1px solid #ccc
    .Newsletters div.title input {font-size:18px;width:500px;} 
    ... 

    Hope this helps.

    Regards,
    Sonya
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Marko
    Marko avatar
    148 posts
    Registered:
    30 Jul 2008
    02 Jun 2009
    Link to this post
    Thanks.  For now, I'll just keep things simple and add the custom CSS directly to the original Sitefinity css files.  I don't have many CSS changes at this point, and I don't necessarily anticipate many more.  But at least now I know what can be done.
  8. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    30 Nov 2009
    Link to this post
    If I have a base style sheet that hides a table (display:none)  then I have a theme that the user can choose that will implement a new style sheet.  This style sheet imports the base style sheet  @import url("../IMA/ima.css");  and shows the table (display:inline !important;)
    The problem is that when in the edit page mode, and the theme selected, the table and the content place holders in it don't show up.  Even if I select the container through the drop down box and add a generic content control that way.  It doesn't show up.

    It does show it through the browser however. I can see the generated table code.

    Thanks you as always.

     

  9. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    30 Nov 2009
    Link to this post
    sorry - got it...  the table was just collasping so I couldn't "see" it... thanks.
Register for webinar
9 posts, 0 answered