find a location for property in a new city

Wednesday, 4 August 2010

IntelliSense for jQuery in Visual Studio 2010

I read this morning in Steve Sanderson's Pro ASP.NET MVC 2 Framework book that it is possible to get IntelliSense when using the popular JavaScript library, jQuery.

Microsoft have decided to implicitly support jQuery by including some of its libraries in their sample MVC project. This is as well as their own AJAX library that comes with a lot of support for ASP.NET Web Forms specific features, which of course you won't be needing in ASP.NET MVC.

Part of their support translates into working with them to provide IntelliSense support to Visual Studio. It is not entirely integrated so will need a touch of set up and here's how to do it:

Let's do it!

First, you need to get the jquery-1.4.1-vsdoc.js file. I got mine by creating a new ASP.NET MVC2 sample web application. You will find it at /Scripts/jquery-1.4.1-vsdoc.js. Copy it from here and put it in your application somewhere sensible.

Then you simply reference the file like so:
<% /* %><script type="text/javascript" src="/js/jQuery/jquery-1.4.1-vsdoc.js"></script><% */ %>

Now you can enjoy such delights as this:

Note

  • You may want to put that reference in your MasterPage so it will work for all pages that use it. It will not work in miscellaneous pages or user controls (unless you add your own reference in those pages).
  • Also note the syntax I used so that users will not download the file as part of their request.
  • This works for VS2010. For VS2008 you may need to download a path that allows Visual Studio to find *-vsdoc.js files automatically

Follow britishdev on Twitter

6 comments:

  1. It is not entirely integrated so will need a touch of set up and here's how to do it HostGator Coupon Code

    ReplyDelete
  2. Food is one of the most memorable parts of any wedding, so choosing the right catering service is important. Couples looking for reliable Caterers in Delhi can compare different options based on their menu, service quality, event size, and budget. Exploring the available choices in advance can make wedding planning much smoother.

    ReplyDelete
  3. A well-planned menu can make a wedding celebration even more enjoyable for guests. Those searching for experienced Caterers in Faridabad can explore different catering options and consider factors such as menu variety, presentation, service, and pricing before making a final decision.

    ReplyDelete
  4. Selecting a suitable caterer is an important part of organizing a successful wedding or special event. This guide can be useful for people looking for Caterers in Ghaziabad, as comparing menus, catering packages, guest capacity, and service options can help in finding a suitable choice for the occasion.

    ReplyDelete
  5. The food and catering service can have a major impact on the overall wedding experience. Anyone planning an event and searching for Caterers in Gurgaon can explore different providers and compare their menus, specialties, presentation, and packages according to the requirements of the celebration.

    ReplyDelete
  6. Good food brings guests together and can make a wedding celebration more memorable. For those planning an event, this resource for Caterers in Noida can help in exploring catering options based on menu preferences, number of guests, budget, and the type of wedding event being organized.

    ReplyDelete