开发者

Javascript Intellisense in ASP.Net Usercontrols

As you will all probably be aware you can reference external Javascript files in Visual Studio 2010 using the following directive.

/// <reference path="MyExternalFile.js" />

Great!

Directives to external Javascript files that exist in masterpa开发者_Go百科ges are automatically transferred to content pages. Again great!

However how can you create a reference to a javascript file inside an ASP.Net usercontrol when the javascript file is declared in a masterpage?

I assume (although untested) that a scriptmanagerproxy would accomplish this. However I do not use a script manager in my web app.

Is there an alternative similar to what I display above for use in a UserControl?


It's a bit ugly but you could reference a JavaScript file just for the user control without rendering it:

<% if (false) { %>
<script src="../scripts/jquery-1.4.1-vsdoc.js"></script>
<% } %>

This way Visual Studio will give you Intellisense:

Javascript Intellisense in ASP.Net Usercontrols

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜