Jeff King from the Web Tools team wrote up a great post earlier this week that answers a
number of common questions about how JavaScript intellisense works with VS
2008. I highly recommend reading it.
One trick he talks about which I'll show here is a technique
you can use when you want to have JavaScript intellisense work within
user-controls/partials (.ascx files). Often you don't want to include a
JavaScript library <script src=""/> reference within these
files, and instead have this live on the master page or content page the user
control is used within. The problem of course when you do this is that by
default VS has no way of knowing that this script is available within the user
control - and so won't provide intellisense of it for you.
One way you can enable this is by adding the <script src=""/>
element to your user control, but then surround it with a server-side <% if
%> block that always evaluates to false at runtime:
Figure 10
At runtime ASP.NET will never render this script tag (since
it is wrapped in an if block that is always false). However, VS will
evaluate the <script/> tag and provide intellisense for it within the
user-control. A useful technique to use for scenarios like the user control
one. Jeff has even more details in his FAQ post as well as his original jQuery intellisense post. Rick Strahl also
has a good post about using jQuery intellisense here.