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 Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js” ></script>
<script type=”text/javascript” src=”file://C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s