I have some JS functions within the user control ASCX, this UC has been loaded several times in the host page. When I make a visual source, I am repeated in JS for every example of UC.
Is there a way that I can only load it once? I would like to reduce the size of the page for better performance.
Put the function in a separate .js file , Then add it by calling the page .. ().
You can also mark the file as an embedded resource, and then include it using Page.ClientScript. ().
Note that if you are using a ScriptManager / UpdatePanels, then use it. Or so that it will be able to properly add context to a partial postback.
Comments
Post a Comment