Multiple javascript for a UserControl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Italian Pete

    Multiple javascript for a UserControl

    Hi,
    I have a usercontrol which includes a small piece of Javascript built up
    as a string in <scripttags 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
  • sloan

    #2
    Re: Multiple javascript for a UserControl

    You'll find more luck in this newsgroup:

    microsoft.publi c.dotnet.framew ork.aspnet


    "Italian Pete" <ItalianPete@di scussions.micro soft.comwrote in message
    news:F670EE47-6C33-46DD-A90B-6ABF3252EC29@mi crosoft.com...
    Hi,
    I have a usercontrol which includes a small piece of Javascript built
    up
    as a string in <scripttags 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

    Comment

    Working...