Running js method on pageload (from usercontrol)

  • Thread starter Thread starter Weston Weems
  • Start date Start date
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
 
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
 
Back
Top