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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Inject javascript to onload event of body element - DNN 4.3.2Inject javascript to onload event of body element - DNN 4.3.2
Previous
 
Next
New Post
7/11/2006 5:33 PM
 

Hi.
In my custom module i try to inject some code into onload event of body element
Like this:
 

'inject JS call into body load
Dim mbody As HtmlGenericControl = CType(Page.FindControl("body"), HtmlGenericControl)
If Null.IsNull(mbody.Attributes("onload"))
Then
   mbody.Attributes.Add("onload", strInit)
Else
   mbody.Attributes("onload") += strInit
End
If

where

strInit is somethig like:   ";" & command & ";"
   strInit = ";" & command & ";"

In DNN 4.3.2 RC
onload event is not processed at all.. and with a simple "View source code" command from Internet Explorer
You can see it is not there.

Am i wrong somewhere ?

Hope we will have a fix pretty soon
That's only in DNN 4.3.2

Also reported on support page http://support.dotnetnuke.com/Default.aspx?p=23&i=3603
Best regards,
Claudiu


Claudiu Farcas

FRIEND SOFTWARE
FRIEND SOFTWARE - business solutions for you ...
 
New Post
7/12/2006 9:58 AM
 

OK
New CORRECTION:

the onload event is write into the BODY..
but is never processed
Why?

Now i will try to make some comparisions between DNN 3.3.x and DNN 4.3.x

Regards,


Claudiu Farcas

FRIEND SOFTWARE
FRIEND SOFTWARE - business solutions for you ...
 
New Post
7/12/2006 11:04 AM
 
Well

At least there is an WORKAROUND:

istead injecting in that way we can use ClientAPI functions

If DotNetNuke.UI.Utilities.ClientAPI.ClientAPIDisabled = False Then 
   DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(Me.Page, _
      DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn)
   UI.Utilities.DNNClientAPI.AddBodyOnloadEventHandler(Me.Page, strInit)
Endif

Courious .. first way works only in DNN 3.3.x (and older releases) but not DNN 4.3.x

Anyone any hints ?


Claudiu Farcas

FRIEND SOFTWARE
FRIEND SOFTWARE - business solutions for you ...
 
New Post
7/12/2006 8:12 PM
 

Claudiu.

Injecting onload events the regular way might cause problems with dnn, thats why the clientapi is there for. If you use the clientapi method, it will work in all dnn 3+ versions...

The issue is that many modules can add onload handlers, the client api methods will make sure all handlers are called appropiately.. whereas if you do it like in your first method, you might override other modules trying the same (in the wrong way...)

cheers,

Erik


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
7/13/2006 1:01 AM
 
Hi Eric.

Indeed, using ClientAPI way we create a "standardised" way for handling onload events (or other events).
But also the first piece of code is handling the overriding case in the "standard asp.net".

The onload event is there .. in the source of page .. so it is rendered right.
The only issue i see here is that this onload event is never fired.
And that's only in DNN 4.3.x verions.

In any ASP.NET application onload event should work just fine.
Even the first method of injection seems too oldish i think it should work at least for legacy code compatibility.

Regards,

Claudiu Farcas

FRIEND SOFTWARE
FRIEND SOFTWARE - business solutions for you ...
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Inject javascript to onload event of body element - DNN 4.3.2Inject javascript to onload event of body element - DNN 4.3.2


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