Javascript Intellisense in ASP.Net Usercontrols

As you probably know, you can reference external Javascript files in Visual Studio 2010 using the following directive.

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

Fine!

Directives for external Javascript files that exist in masterpages are automatically transferred to content pages. Great again!

However, how can you create a link to a javascript file inside an ASP.Net user control when the javascript file is declared on the main page?

I assume (albeit untested) that scriptmanagerproxy will do this. However, I do not use the script manager in my web application.

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

+5
source share
1 answer

This is a little ugly, but you can only reference the JavaScript file for the user control without rendering :

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

This way Visual Studio will provide you with Intellisense:

enter image description here

+3
source

All Articles