views:

424

answers:

3

I've followed all the steps to get intellisense working for jQuery in VS 2008 SP1 (with the vsdoc hotfix). It works when I reference jQuery inside an asp:ScriptManager control like so:

<asp:ScriptManager runat="server">
<scripts>
...
</scripts>
</asp:ScriptManager>

But I'm using ajax ToolkitScriptManager instead and the intellisense doesn't seem to work when using this control. It offers some better features so I'm not willing to live without it.

It looks like the VS team only programmed the jQuery intellisense to look for asp ScriptManager controls and not ToolkitScriptManager. Has anyone found a workaround for this specific problem?

Cheers

A: 

If the file is contained in your project with a -vsdoc.js at the end, IntelliSense should work. Rick Strahl has a great post about this at http://www.west-wind.com/Weblog/posts/536756.aspx

Jason N. Gaylord
The problem is however - it works fine and dandy until I switch over to the ajax ToolkitScriptManager control. I guess this was just an oversight.
wows
+1  A: 

Wows, I, had the same problem and used the following method to trick Visual Studio:

<% if(false) { %>
    <script src="/scripts/jquery-1.3.2.js" type="text/javascript"></script>
<% } %>

The script tag will never be rendered but VS interprets it and enables intellisense.

Jimmy
A: 

A different question: why are you putting the JQuery library in the script manager?

The script manager can do some cool things, like compress the javascript files for you -- but that only works if the JavaScript is in a resource file.

Also, using the ScriptManager adds a bunch of extra JavaScript that will not be downloaded by the client (all of the Microsoft AJAX libraries). Which is fine so long as you are using the Microsoft AJAX Toolkit, but is a lot of extra load if you are not.

EDIT: if you want a better relative position get JQuery from Google Code. You can read about it here: http://code.google.com/apis/ajaxlibs/

Chris Brandsma
In this case, ajax ToolkitScriptManager was being used already as there is heavy use of AJAX within the site. The reason I put the jQuery reference in there was so that VS2008 could find it via an application relative path (~/etc).
wows
If you are worried about the relative path you should check out http://code.google.com/apis/ajaxlibs/
Chris Brandsma