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

View previous topic View next topic 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
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Jennifer's Body
» xTRSx Unknown Wide Body/RE-Amemiya Shop (Open)
» Breeze body HD version?
» Body Textures mismatched
» Skyrim's EyeCandy Body (ADEC Body) Picture Gallery

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: