javascriptjqueryasp.netdotnetnuke-moduledotnetnuke-7

How to set path(source) of image file or any other file in .js or CSS file in DotnetNuke?


I am working on DotnetNuke 7. I am creating Module using ASP.Net. I have created Module in Visual Studio 2015 and upload it as Extension in DotnetNuke(www.dnndev.me).

Everything is working fine except file management. I get stuck most time in case of file path.

I have .JS file. It has following code for Loading image. Now I don't know how to set path for it.

Following code will provide loading to screen. I have reviewed this in my demo ASP.Net project which is working perfectly. But when it comes to DotnetNuke, it doesn't work at all.

This is physical path of Loading F:/websites/dnndev.me/DesktopModules/CustomerDemo/Assets/Images/ajax-loading.gif

What path should I set in message:'<img src="http://localhost:60380/Assets/Images/ajax-loading.gif" align="">'?

blockUI: function (el, centerY) {
    var el = jQuery(el);
    el.block({
        message:'<img src="http://localhost:60380/Assets/Images/ajax-loading.gif" align="">',
        centerY: centerY != undefined ? centerY : true,
        css: {
            top: '10%'
        },
        overlayCSS: {
            backgroundColor: '#000',
            opacity: 0.05,
            cursor: 'wait'
        }
    });
},

1- What path should I set in above case?

2- Do I need to register this path anywhere in my project?


Solution

  • You can use the path relative to the root of the DNN installation.

    <img src="/DesktopModules/CustomerDemo/Assets/Images/ajax-loading.gif">