开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜