dotnetnuke - How do I plug in jQuery and CSS in a DNN Module? -


i have looked @ this article ventrian , another here in our community. cannot seem work, here module looks in nutshell.

view.aspx

<%@ control language="c#" inherits="kdmc.modules.kdmc_usertraderlistview.view" autoeventwireup="false"  codebehind="view.ascx.cs" %> <%@ register tagprefix="dnn" namespace="dotnetnuke.web.client.clientresourcemanagement" assembly="dotnetnuke.web.client" %>  <asp:panel id="panel1" runat="server">                             <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1" onitemdatabound="traderworks">         <headertemplate>             <table id="datatable">             <thead>             <tr>             <th>some heading</th>                             </tr>             </thead>         </headertemplate>          <itemtemplate>             <tr>             <td><%# eval("somedata")%></td>                             </tr>         </itemtemplate>          <footertemplate>          </footertemplate>      </asp:repeater> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:sitesqlserver2 %>" selectcommand="select whatever wherever"></asp:sqldatasource>  <script type="text/javascript">     $('#datatable').datatable(); </script>  <dnn:dnncssinclude runat="server" filepath="~/desktopmodules/<modulename>/media/css/jquery.datatables.css" /> <dnn:dnnjsinclude runat="server" filepath="~/desktopmodules/<modulename>/media/js/jquery.js" /> <dnn:dnnjsinclude runat="server" filepath="~/desktopmodules/<modulename>/media/js/jquery.datatables.min.js" /> </asp:panel> 

according articles , anytime have ever plugged css , jquery skin file should work! causing dnn not see in module?

edited

i think see issue. think dnn seeing files plugged in using <dnn:dnncssinclude runat="server> or <dnn:dnnjsinclude runat="server> tags. module not see

<script type="text/javascript">     $('#datatable').datatable(); </script> 

how fix this? according this article in our community needs instantiated. how do this?

my guess problem due relative placement of various scripts , content. if using firefox, can hit ctrl-shift-j bring error console , display javascript errors when refresh page.

anytime you're dealing javascript in dnn (or asp.net), it's important @ rendered code (by doing view source (ctrl-u) on page) can see being generated code. assuming you're using recent version of dnn (6.x or greater) shouldn't need instantiate jquery can verify looking @ source , verifying jquery being included. should verify jsincludes being rendered before "$('#datatable').datatable();" script , datatable object being rendered above script well. if not, can specify placement of jsinclude bits specifying provider within call (i.e. forceprovider="dnnpageheaderprovider")


Comments