Enable ECMA IntelliSense Sandboxed Visual WebPart…!!!

When working in Visual Studio we really a lot upon intelisense. Recently I started working on some SharePoint Online related work with ECMA Scripts and was finding very difficult to survive without VS intelisense.

There are many blog posts and articles  that illustrate how to enable intellisence in VS for ECMA Scripting. But most of them are not working with Sandboxed solutions and specifically with Sandboxed Visual Web Part (the template comes with SharePoint Power Tools)

So struggling for some time I was able to figure out how to enable it on Sandboxed Visual Web parts.

Steps:

1) Create the Sandboxed Visual Web Part from the VS Item template.

2) Add following entries just after the control registrations of the ascx file.

<% #if SOME_UNDEFINED_CONSTANT %>
<script type=”text/javascript” src=”file://C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTSMicrosoftAjax.js” ></script>
<script type=”text/javascript” src=”file://C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14TEMPLATELAYOUTSSP.debug.js”></script>
<% #endif %>

3) Start a new script tag below the above declarations as given below.

<script type=”text/ecmascript” language=”ecmascript”>

</script>

4) Write down your code with intellisence support inside the above script block.

image

Happy coding! Smile

Leave a Reply

Your email address will not be published. Required fields are marked *