Forum


HomeHomePremiumPremiumDevelopmentDevelopmentUsing the template, how to include image and css files? Using the template, how to include image and css files?
Previous
 
Next
New Post
10/13/2014 8:43 PM
 

I have an image and a css file that I wanted to include in one of my .ascx files using VS 2013.

I dropped the image file into the .ascx file, and it shows up great in VS. 

When loaded on my dnndev.me website, the URL for the image is

http://dnndev.me:80/Icons/ credit_card_logos_visa_mc_amex_discover_paypal_sm.gif insteadl


of http://dnndev.me:80/ DesktopModules/RegisterTeams/ Icons/credit_card_logos_visa_mc_amex_discover_paypal_sm.gif 

I am having the same issue with a .CSS file. Is there an easy way to get these to resolve properly? I am sure I am missing something obvious.


 
New Post
10/14/2014 5:18 AM
 

Hi Kevin,

1 - For images I usually do something like this inside the .ascx file:

< % = ModulePath % > images/my-image.jpg

This will give you the correct path for images inside your module folder - (I have added extra spaces so that the forum editor doesn't break it)

2 - In regards to CSS or JS files I usually do something like this within the code:

        protected void Page_PreRender(object sender, EventArgs e)
        {
            ClientResourceManager.RegisterStyleSheet(this.Page, base.ControlPath + "Resources/css/module.css", DotNetNuke.Web.Client.FileOrder.Css.DefaultPriority);
        }


 

I hope this helps.

Cheers,

Aderson

 
New Post
10/14/2014 2:10 PM
 

Thanks, those suggestions worked. I found another option

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<dnn:DnnCssInclude runat="server" FilePath="~/DesktopModules/RegisterTeams/Style/GridStyles.css" />

which also appears to be working nicely for the CSS file. 

Interestingly, FilePath="< % = ModulePath % >/RegisterTeams/Style/GridStyles.css" doesn't work. 

 
New Post
10/14/2014 9:24 PM
 

I am still trying to determine why <dnn:DnnCssInclude runat="server" FilePath="<%= ModulePath %>/Style/GridStyles.css" /> doesn't appear to work properly where as <img alt="Credit Card Logos" class="auto-style26" src="<%= ModulePath %>/Icons/credit_card_logos_visa_mc_amex_discover_paypal_sm.gif" /> does work properly.

Seems like it should. Any thoughts on the subject greatly appreciated. 

Kevin

 
New Post
10/15/2014 5:04 AM
 
try this <%# ModulePath %> instead of <%= ModulePath %>
 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentUsing the template, how to include image and css files? Using the template, how to include image and css files?



Try FREE
30 days money back guaranteed