Click here to Skip to main content
15,886,362 members
Articles / Productivity Apps and Services / Sharepoint
Tip/Trick

Enabling JavaScript intellisense in VS.NET 2010 to work with SharePoint 2010

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
16 Apr 2010CPOL 39.8K   6  
To enable JS intellisense in Visual Studio 2010, you have two options (there are others to do with reference tag name and assembly) but these are the ones that I know work.i) Add a JavaScript file to an AJAX server control project (which references System.Web.Extensions and hence the...
To enable JS intellisense in Visual Studio 2010, you have two options (there are others to do with reference tag name and assembly) but these are the ones that I know work.

i) Add a JavaScript file to an AJAX server control project (which references System.Web.Extensions and hence the embedded resource MicrosoftAJAX.js - you could also probably add an assembly reference to a web.config for the same effect but I haven't tried it).

ii) Add the following reference tags to the top of the JS file:

MSIL
/// <reference name="MicrosoftAjax.js"/>
/// <reference path="C:\\path-to-js\\SP.UI.Dialog.debug.js"  />


iii) Add JS equivalent 'using' statements to top of JS (below reference) - Type.registerNamespace("SP.Ribbon"); etc.

The other way is to add:

XML
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/SP.UI.Dialog.debug.js" />
    </Scripts>
</asp:ScriptManagerProxy>
<script type="text/javascript">
...script
 </script>


to an aspx page.

Use Ctrl + Shift + J to update javascript intellisense in visual studio.

Adding the debug version is needed because the non debug version is compressed for performance reasons using an older version of Script#.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --