DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Associating CSS file with Custom Module

 6 Replies
 2 Subscribed to this topic
 16 Subscribed to this forum
Sort:
Author
Messages
Growing Member Send Private Message
Posts: 27
Growing Member

Hello, I'm following this article to associate a CSS file with its corresponding custom Web User Control but it's not loading the CSS and I think it's because they need to be within the scope of a Theme/Skin directory? see screenshot.

https://docs.dnncommunity...reate-css/index.html

Thank you!

Veteran Member Send Private Message
Posts: 1184
Veteran Member

Well, yes and no. In the context of the Theme there are some fiels that are loaded "by convention". Or for a module if the file is named module.css For all other css files you should use the Client Resource manager to load them: https://docs.dnncommunity.org/content/tutorials/client-resources/index.html

Growing Member Send Private Message
Posts: 27
Growing Member
Perfect! I was already using Client Resource manager but I like module.css better
New Around Here Send Private Message
Posts: 6
New Around Here

I believe you are looking for #5. Rename the file to module.css and move it up one directory. The module.css is not isolated to just one Web User Control, it will load on all user controls within the module. I've had trouble in the past doing this after a module is already installed and sometimes takes removing the module from the Extensions and re-adding it to see the module.css file. I don't believe there is isolation to just one control unless you specifically load the .css file by name.

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> <dnn:DnnCssInclude id="cssHomePublic" runat="server" filepath="~/DesktopModules/CVContent/HomePublic/HomePublic.css" />

Happy DNNing

Growing Member Send Private Message
Posts: 27
Growing Member

yes, it was #5 but I didn't catch that when reading, I thought I still had to specify the full path and so on, I'm looking for automation so, module.css it is... thank you

Senior Member Send Private Message
Posts: 1513
Senior Member

Ryan's reply will work too, but it's more work to do and maintain.  You should always use the module.css, unless you have a good reason not too.  It just works and all you have to do is be sure the file is in the correct place with the expected name.  Done, and done!  😎 

Growing Member Send Private Message
Posts: 27
Growing Member

Yes, that's what I had working but I like module.css better... thank you

These Forums are dedicated to the discussion of DNN Platform.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved