Rudebox.co.nr How To Forums

Rudebox How To Forums - Ask Anything, View How To's
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 How to programmatically add onLoad to Body Tag /Raise Onload

Go down 
AuthorMessage
Admin
Admin
avatar

Number of posts : 216
Registration date : 2007-01-01

PostSubject: How to programmatically add onLoad to Body Tag /Raise Onload   Tue Jan 08, 2008 5:52 pm

If you can access the tag in the .aspx page

make it

Code:
<body id="myBody" runat="server">

In The Code Behind add

Code:
this.myBody.Attributes.Add("onLoad", "myJavaScript()");

or

Code:
HtmlGenericControl myBodyTag = (HtmlGenericControl) myBody;
myBodyTag.Attributes.Add("onLoad", "myJavaScript()");

Sometimes you cant access the OnLoad Tag
for example if you have a master Page, and trying to access it from a child Page.

Then you can use something like this at the bottom or top of the .aspx (Tested)

Code:
  <iframe onload="myJavaScript()" visible="false" style="display: none" >
    </iframe>

or In Code (Not Tested)
Something like
VB.net
Code:

CType(Page.Master,MyMasterClassName).Body.ClientID
Back to top Go down
View user profile http://rudebox.editboard.com
 
How to programmatically add onLoad to Body Tag /Raise Onload
Back to top 
Page 1 of 1
 Similar topics
-
» Some star Wars figure customs
» Hot Toys TDK. thanks again good doc.
» Steve Holt's Workshop Presents......
» Fantage pixel improvement?
» 3D Carbon Fiber Vinyl di SYM anda

Permissions in this forum:You cannot reply to topics in this forum
Rudebox.co.nr How To Forums :: How To - Myspace / Website /Blog Utilities :: ASP .net-
Jump to: