More JavaScript Intellisense goodies: another great reason to use ScriptManager
I have been tinkering with different JavaScript Intellisense scenarios in Visual Studio 2008. I just stumbled onto a feature I did not know existed thanks to an internal discussion. First, if you use a ScriptManager in your page to reference other JavaScript files and service references like so:
MyPage.aspx:
...
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Name="PreviewScript.js"
Assembly="Microsoft.Web.Preview" />
<asp:ScriptReference Path="MyPage.aspx.js" />
</Scripts>
<Services>
<asp:ServiceReference Path="OfficesService.svc" />
</Services>
</asp:ScriptManager>...
Next, if you like to put all of your JavaScript in a separate "code beside" like I do, then all you have to do is reference MyPage.aspx in MyPage.aspx.js like so:
/// <reference path="MyPage.aspx" />
Once you have done this, you will get JavaScript Intellisense in MyPage.aspx.js for everything that was referenced in your ScriptManager. Now if you add a reference to the ScriptManager, you automatically get JavaScript Intellisense in your "code beside" .js file. Before I found this feature, I would add duplicate "/// <reference/>" entries in my MyPage.aspx.js file corresponding to the entries in my ScriptManager. It was a maintenance hassle as references changed. Problem solved:).
-Marc