Add body onload attribute from UserControl?

J

John Kotuby

Hi all,

My application consists of a MasterPage which is used for all WebForms. I
then create UserControls to populate the content area for the different
WebForms.

In one complicated UserControl I have a number of Javscript functions.
Everything on the page works fine, until I try to add the OnLoad event
attribute to the Body tag which is generated by the Master Page.

I want to call a Javascript function upon Load of the page, but not for all
webforms, because only this particular control has the function declared.

How can I add the attribute from the code-behind of the User Control? I
can't add it in the declaration in the Master Page, because only one form
contains the code. Also, the JS Function references other document elements
that only reside in the particualr UserControl. Do I have a catch-22 here,
or can it be done?

Thanks to all...
 
G

Guest

Try emitting the window.onload =functionname; convention instead. It works
the same.
Peter
 
J

John Kotuby

Many thanks Ben,

The code works just fine. You have saved me a bunch of time on a tight
schedule....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top