How to ensure javascript is included only once when used inside an ASCX
I've an ASCX includes a javascript. If I use this ASCX more than once on a page I have the javascript definition r开发者_JS百科epeated.
Is there a standard clean way to prevent this without define it on a masterpage?
Check out the ClientScriptManager class. Specifically the RegisterClientScriptBlock
and RegisterClientScriptInclude
methods.
精彩评论