Rudebox.co.nr How To Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Rudebox.co.nr How To Forums

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

 

 How to programmatically add onLoad to Body Tag /Raise Onload

Go down 
AuthorMessage
Admin
Admin
Admin


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

How to programmatically add onLoad to Body Tag /Raise Onload Empty
PostSubject: How to programmatically add onLoad to Body Tag /Raise Onload   How to programmatically add onLoad to Body Tag /Raise Onload Icon_minitimeTue 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
https://rudebox.editboard.com
 
How to programmatically add onLoad to Body Tag /Raise Onload
Back to top 
Page 1 of 1
 Similar topics
-
» DefaultButton , On Enter Press Raise Default Button Event

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: