Visual Studio Orcas JavaScript IntelliSense

Michael Schwarz on Saturday, April 28, 2007

Bertrand [1] has a great post about JavaScript IntelliSense [2] with the next Visual Studio .NET code-name Orcas. I downloaded the bits to give it a try. Oh yes, it is working great when creating ASP.NET AJAX Web applications.

What about Web developers not using ScriptManager?

Hm, next I tried to run my AjaxPro [3] library and add some JavaScript IntelliSense for next Visual Studio .NET. I tried several ways to include the on-the-fly generated JavaScript files, but I couldn't find any that would work. Only generating of theses files and including them as static JavaScript files was working.

I contacted Bertrand and the ASP.NET team to find a solution, but there is no real way to add generated JavaScript files during development.

The way JavaScript IntelliSense is working is to include eithere a <reference/> tag in the top of static JavaScript files or include them with the ScriptManager. But how can I include JavaScript files with the ScriptManager object if I don't want to use the automatic added ASP.NET AJAX JavaScript core scripts? Currently there is no way to disable core ASP.NET AJAX scripts. I'm still in hope that they will add this simple property to the ScriptManager, but Bertrand already told me that it is very late to be included in Orcas.

One way to workaround this and use the ScriptManager without adding the core ASP.NET AJAX scripts could be this:

protected override void OnPreInit(EventArgs e) {form1.Controls.Remove(ScriptManager1);

<span class="rem">// add now all your JavaScript files again</span> <span class="rem">// this.ClientScript.RegisterClientScript(...);</span>

<span class="kwrd">base</span>.OnPreInit(e); }</pre>

This will enable JavaScript IntelliSense without using the ScriptManager.

Where do I see problems?

The main problem I see is with the JavaScript IntelliSense is that it will only work if running ASP.NET AJAX applications. But what about using this without? What is if you want to use any other popular JavaScript framework? Because JavaScript IntelliSense includes (<reference/> tag) are only working in static JavaScript files it is not easy possible to have IntelliSense available for other frameworks.

Maybe I didn't see all ways to include external files, but if I need to use the ASP.NET AJAX ScriptManager I cannot develop Web applications that are working on mobile devices because not all JavaScript inside the core script files are working on older Web browsers or i.e. Windows Mobile. If you have any idea or solution feel free to add a comment below.