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

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...problem with load jquery as first in ascx skinproblem with load jquery as first in ascx skin
Previous
 
Next
New Post
9/7/2009 4:15 PM
 

Hello,

I;ve got the follwing code on my onload of my skin:

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
DotNetNuke.Framework.jQuery.RequestRegistration()
AttachCustomHeader("<link href='" + SkinPath + "css/my_layout.css' rel='stylesheet' type='text/css' />")
AttachCustomHeader("<!--[if lte IE 7]><link href='" + SkinPath + "css/patches/patch_my_layout.css' rel='stylesheet' type='text/css' /><![endif]-->")
AttachExternalJS("http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js")
AttachExternalJS(SkinPath + "js/jquery.colorbox-min.js")
AttachExternalJS(SkinPath + "js/colorbox-img.js")
End Sub

Sub AttachExternalCSS(ByVal CSSPath As String)
AttachCustomHeader("<link type='text/css' rel='stylesheet' href='" & CSSPath & "' />")
End Sub

Sub AttachExternalJS(ByVal JSPath As String)
AttachCustomHeader("<script type='text/javascript' src='" & JSPath & "'></scr" & "ipt>")
End Sub

Sub AttachCustomHeader(ByVal CustomHeader As String)
Dim HtmlHead As HtmlHead = Page.FindControl("Head")
If Not (HtmlHead Is Nothing) Then
HtmlHead.Controls.Add(New LiteralControl(CustomHeader))
End If
End Sub

The problem is that jquery is loaded as last(Just before the </head>). With the AttachExternalJS sub it is loaded correct, but in the admin function and some modules the jquery framework is registerd 2 times. Can someone help me with what i'm doing wrong?

 
New Post
9/7/2009 6:54 PM
 

AFAIR JQuery fires a special event when loaded, please check out JQuery documentation.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/7/2009 7:05 PM
 

I guess this is because DNN is using Jquery in the admin interface and some modules do too.

 
New Post
9/8/2009 1:54 AM
 

That is not the problem. The problem is for jquery plugin that jquery need to be loaded first. With the register command the jquery is loaded as last after the plugins.

 
New Post
9/8/2009 12:43 PM
 

Ok, I don't understand... you wrote:
"....but in the admin function and some modules the jquery framework is registerd 2 times."

 But the issue is jquery should load bedfore the plugins...

I use this to load JS (and jQuery):

 

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'add a script reference for Javascript to the head section
        Dim oLink As New HtmlGenericControl("script")
        oLink.Attributes("type") = "text/javascript"
        oLink.Attributes("src") = SkinPath & "js/jquery-1.3.js"
        Dim oCSS As Control = Me.Page.FindControl("CSS")
        If Not oCSS Is Nothing Then
            oCSS.Controls.AddAt(0, oLink)
        End If
       
    End Sub

 

That always works..

 

 

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...problem with load jquery as first in ascx skinproblem with load jquery as first in ascx skin


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