Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Custom Module and jQuery in DNN 07.05.00Custom Module and jQuery in DNN 07.05.00
Previous
 
Next
New Post
4/29/2013 8:01 PM
 
Using DNN 07.05.00 and in my custom ascx module I want to use some css and jQuery. For this I added to ascx file:
<!--Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client"-->

<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>

<dnn:DnnCssInclude runat="server" FilePath="~/DesktopModules/StreetlinkModules/test.css" />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/StreetlinkModules/Test.js" />

Created both test.css and Test.js files and saved them under DesktopModules/MyModule folder.

Added as well:

DotNetNuke.Framework.jQuery.RequestRegistration();

in my Page_Load method in ascx.cs file.

All works fine.

Then I commented the DotNetNuke.Framework.jQuery.RequestRegistration();

and rerun the web site. It still works as before.

So, my question is: Should I or shouldn't I use this RequestRegistration at all, because it seems the module work just fine with and without it?

Thanks.

 
New Post
4/29/2013 8:06 PM
 
Empty
 
New Post
4/30/2013 12:05 AM
 
Anyone? No opinion on this?
 
New Post
4/30/2013 2:52 AM
 
Hi,

DNN 5+ allows module developers to register jQueryExternal Link to be loaded only when modules need it.  Just call DotNetNuke.Framework.jQuery.RequestRegistration().  This prevent jQueryExternal Link from being loaded when it’s not used.  If your skin is using widgets, this is not necessary, but should be done for commercial modules regardless.
For more details visit this link.

Thanks,
Avinash Kumar
Mindfire Solutions,India
 
New Post
4/30/2013 4:44 PM
 
Avinash is correct that the Widgets framework will use jQuery and force it to load on the page.  The control panel will also force jQuery to be rendered on the page.  However, you should never rely on someone else to request jQuery for you because you can never be certain when the admin might turn off or remove the other feature or module.  Instead, the best practice is that if your module uses jQuery, then you should always request registration.  This will guarantee that you will always have jQuery on the page when you need it.

Joe Brinkman
DNN Corp.
 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Custom Module and jQuery in DNN 07.05.00Custom Module and jQuery in DNN 07.05.00


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

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

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. 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.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out