Multiple javascript for a UserControl

G

Guest

Hi,
I have a usercontrol which includes a small piece of Javascript built up
as a string in <script> tags and put onto a web page when an instance of the
User Control is created. The Javascript does some client side checking of
User Input.

If I use multiple instances of the same user control on a page, the same
block of Javascript is repeatedly written to the page (once for each instance
of the user control). Although the user controls still work, it creates a
bigger page to download from the server.

Is ther any way of just writing the Javascript the once to the page? or is
there a better way of getting the Javascript written. (I wanted to keep the
Javascript integral to the user control so that it was independent).

Many thanks,

Pete
 

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

Top