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

Forums / Developing with Sitefinity / Custom module example - external css

Custom module example - external css

5 posts, 0 answered
  1. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    03 Feb 2010
    Link to this post
    Hi Ivan,

    Following on from our conversation here, I've been working on a custom module based on your example linked at the bottom of the thread.

    A small detail I have noticed is that within other modules in Sitefinity, a modules.css is linked within the page, but when working with your code / derived module code, the modules.css is omitted from the HTML output. This is causing layout issues as the modules.css file corrects layout issues within the example markup.

    Is there a "proper" way of linking the modules.css into custom modules, rather than hardcode paths into the markup within the module's assembly?

    I have seen the AddView<TView> method within an iGenericContentHost control have a parameter titled "viewCommandCssClass", but I can't see how that relates to it - is there another way?


    Regards,
    Alvaro
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Feb 2010
    Link to this post
    Hi Alvaro,

    viewCommandCssClass is a string. If you do not specify anything there the default css is loaded. This css is called "all" and it is declared inside |~/Sitefinity/Admin/Themes/Default/Modules.css. You can add your custom css to Modules.css and then pass it as a AddView parameter. Another option is adding some css to the template of your view.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    03 Feb 2010
    Link to this post
    Hi Ivan,

    I don't think I'm explaining myself clearly enough.

    At the moment, using an identical markup to your example module for the NewView markup, it appears like this:

    http://www.haushinka.org/media/sitefinity1.jpg

    The reason why the layout is broken is that by default, sitefinity does not link modules.css to those pages. If you look at the News NewView, there is a link in the page header to modules.css

    My question is - what's the best way to link that css file from within a custom module? Is there a property in the project / class hierarchy that needs to be set, or should I be adding it in the markup of the NewView.ascx control?


    Regards,
    Alvaro
  4. Andree
    Andree avatar
    44 posts
    Registered:
    11 Jan 2010
    04 Feb 2010
    Link to this post
    With a bit of digging around, I believe I've answered my own question.

    I used the CssFileLink control to link to the modules.css stylesheet within every view of my custom module:

    <%@ Register TagPrefix="sf" Namespace="Telerik.Cms.Web.UI" Assembly="Telerik.Cms.Web.UI" %>
      
    <sf:CssFileLink runat="server" Media="screen" FileName="~/Sitefinity/Admin/Themes/Default/modules.css" />

    Regards,
    Alvaro
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    04 Feb 2010
    Link to this post
    Hello Alvaro,

    First the parameter you refer gets the view command CSS class which is used for automatically generated command panels. This is the view command CSS class, since CssFileLink is used to set class the the view.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Register for webinar
5 posts, 0 answered