开发者

How to ensure javascript is included only once when used inside an ASCX

开发者 https://www.devze.com 2023-03-26 01:14 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消