views:

31

answers:

1

Now the weird thing is I have a user control UserControl1 in which I put some JavaScrdipt logic there, and I have another user control UserControl2 and I registered both in the page called Page1.aspx.

I would like to call the JavaScript function resided in UserControl1 from UserControl2, however, I got an error saying the function is not defined. I think both user controls are loaded before I use them then I think the JavaScript function can been seen anyway in that page.

And what is the loading step for aspx page and JavaScript code?

Any idea?

+2  A: 

If you want to have such reuse of java script, then put those script in a seperate .js file and include the file on both control and set cachable. only on copy of the file will be downloaded by the client and used by both controls.

Dharma