Search code examples
dotnetnuke

CSS In DNN Modules


How could i include the custom css & JavaScript for particular module in DotnetNuke?

I understand that it is not like normal ASP.Net page.


Solution

  • If your module has a file named module.css in the root of the module folder, it will automatically get included on the page with the module.

    For other CSS and for JavaScript, you should use the Client Resource Management framework to include the resources you want. Something like this:

    <%@ Register TagPrefix="dnn" 
        Namespace="DotNetNuke.Web.Client.ClientResourceManagement" 
        Assembly="DotNetNuke.Web.Client" %>
     
    <dnn:DnnCssInclude runat="server"
        FilePath="~/DesktopModules/MyModule/css/the-style.css" />
    <dnn:DnnJsInclude runat="server"
        FilePath="~/DesktopModules/MyModule/js/the-script.js"
        ForceProvider="DnnFormBottomProvider" />