Running js method on pageload (from usercontrol)

W

Weston Weems

I know this must be something simple I am not doing rihgt.

I have a page init method that sets up some javascript
variables etc, all worked well as a straight aspx page.

Now I'd liek to include functionality from this control in
a usercontrol, and it appears if I do <body
onload="initScroller()"> in either my usercontrol or my
parent page... I find that the variables that were
supposed to be initialized never were.

Am I supposed to do anythign special in this case?

eg, registerstartupscript or something? (I thought I could
do all that stuff just as well with straight html+js)

Wes
 
K

Karl

not 100% sure I understand what you are doing, but try:
Page.RegisterStartupScript("InitControl", "<script language='javascript'>" &
System.Environment.NewLine & "initScroller();" & System.Environment.NewLine
& "</script>")

Karl
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top