home » articles » jQuery Intellisense in Visual Studio 2008

jQuery Intellisense in Visual Studio 2008

change text size: A A A

7/15/2009 by raghav_khunger


In this article i will discuss how to add jQuery intellisense in Visual Studio 2008. I will discuss


•    How to add jQuery intellisense in .aspx page.
•    How to add jQuery intellisense in  external  javascript file.
•    How to add jQuery intellisense in .ascx usercontrol.


Step1:Install  Visual Studio 2008 Service Pack 1.


To see whether you have already installed version of Visual Studio 2008 Service Pack 1.
Open Visual studio. Go to Help>>About Microsoft Visual Studio

 

 


The About Microsoft Visual Studio window will open.



Notice that there should be Version…..SP.  That is SP denotes that service pack is installed on your machine.

If visual studio service pack is not installed then your first step is to install it.




Step2:Download and install VS2008 SP1 Hotfix to Support "-vsdoc.js" IntelliSense Doc Files
You can get information regarding hot fix in detail on below links
http://blogs.msdn.com/webdevtools/archive/2008/11/07/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx
http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736


Step3:Download the jQuery-vsdoc.js file
Go to http://docs.jquery.com/Downloading_jQuery#Download_jQuery
You will find different releases of jQuery .I am showing you an example of jQuery 1.3.2 release.

 

 

Click Visual Studio link in front of Documentation tag. You will be redirected to next page.
In next page you can found the link for downloading jQuery-vsdoc.js file

Note the file name is  jQuery-VersionNumber-vsdoc2.js.After downloading that rename it to jQuery-VersionNumber-vsdoc.js. You would have noticed that I have removed 2 from the vsdoc2 in the end. Now there are two scenarios’ you might be working with
•    jQuery-VersionNumber.js (for example jquery-1.3.2.js)
•    jQuery-VersionNumber.min.js (for example jquery-1.3.2.min.js)

I will explain how to deal with both scenarios
I have taken a scripts name folder in my root directory.


In first case jQuery-VersionNumber.js (for example jquery-1.3.2.js)
Now my jQuery script file is  jquery-1.3.2.js.And I have renamed that vs doc file as jQuery-VersionNumber-vsdoc.js ie I have named that file as  jquery-1.3.2-vsdoc.js






In second scenario jQuery-VersionNumber.js (for example jquery-1.3.2.min.js)
Now my jQuery script file is jquery-1.3.2.min.js.And I have renamed that vs doc file to  jQuery-VersionNumber.min-vsdoc.js i.e. I have renamed that file as  jquery-1.3.2.min-vsdoc.js



I have added an .aspx page Default.aspx in the root directory.
Got to Source view of Default.aspx page





Add reference of jquery script file to Default.aspx page

 

 

Now press CTRL+ SHIFT+J to update the Jscript intellisense or Go to
Edit>>IntelliSense>>Update Jscript Intellisense

 

 

You will see Update JScript Intellisense message.



And that’s it you are done.:)
Now you can test that your jQuery intellisense has started working.


 

 

 

 

How to add  jQuery Intellisense in External javascript file


I have added one more javascript file with name My.js in script folder

Add the reference of jQuery file at the top of My.js file
/// <reference path="jquery-1.3.2.min.js" />


Now press CTRL+ SHIFT+J to update the Jscript intellisense or Go to
Edit>>IntelliSense>>Update Jscript Intellisense
And that’s it you are done.:)




You can check in My.js for jQuery intellisense.



How to add  jQuery Intellisense in UserControl


I have added one folder with name usercontrols and also added on usercontrol with name TestUserControl.ascx.



Add the below code at the top of the TestUserControl.ascx page


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


Now press CTRL+ SHIFT+J to update the Jscript intellisense or Go to
Edit>>IntelliSense>>Update Jscript Intellisense
And that’s it you are done.:)


You can check in TestUserControl.ascx for jQuery intellisense.Now you will be wondering why I have added that script tag
<script type="text/javascript" src="../scripts/jquery-1.3.2.min.js"></script> in this TestUserControl.ascx usercontrol ,as in most scenarios I believe  that reference to the script file is already present in Master page or in the .aspx page where you want this usercontrol to be present.Then Why??? and one thing more you would have noticed in the code
<%  if (false) {%>
……..
<%} %>


The logic behind is that at run time if (false ) will always return false.So ASP.NET engine will never render that script tag. But Visual studio will catch that and provide you intellisense while you are working with your code development.

So In above article I hopes you are cleared with these
•    How to add jQuery intellisense in .aspx page
•    How to add jQuery intellisense in .aspx external  javascript file
•    How to add jQuery intellisense in .ascx usercontrol.



More References


http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-intellisense-for-jquery.aspx
http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx
http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx
http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx
http://www.west-wind.com/Weblog/posts/536756.aspx


Happy Reading !





tags jQuery Intellisense in Visual Studio 2008
To rate this article please register or login

Author

raghav_khunger raghav_khunger (Member since:4/19/2009)

Comments (1)

  • Vijjendra 7/15/2009 2:20:32 AM by:  Vijjendra
    It is very helpful...

Post a comment

Comment (No HTML)  

Type the characters:
 *
 
   

Related articles

Join CodeAsp.Net for FREE Today!

It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.

enter your email address:

Latest Articles RSS Feed

Latest Articles

  • Hi Friends, Many times we came cross the requirement when we need to access the dropdownlist's selectedindexchanged event inside the gridview, like in a shopping cart changing the item's quantity or binding the other dropdown based on the first dropdown.
  • This is the approach that I have adopted to develop Expandable / Collapsible Panel Control through JavaScript. Please report bugs, errors and suggestions to improve this control.
  • This is my approach to develop custom JavaScript ListBox control. Although it is only a subset of existing HTML ListBox element, it is more user friendly than the existing one. It can be further customized for different requirements. Please let me know about bugs and/or errors & give suggestions to improve this ListBox control.
  • I have tried my best to make this user control code error free. I will most welcome suggestions for further improvement in this user control. I have tested this user control on various browsers and it works fine.
  • So, this is my approach to implement an ASP.NET slide show using the DataList. I have tried my best to keep it bug free. I will most welcome suggestions and criticism for further improvements of this user control. I have tested this user control on various browsers and it works fine.
  • As we all knows that Repeater and DataList does not have auto paging support technique like Gridview or Datagrid, but we can achieve this through PagedDataSource. By using PagedDataSource we can implement paging in Repeater or DataList. Now in our mind there is question arise what is PagedDataSource. PagedDataSource is a class which encapsulates
  • So this is my approach. I was working for a long time to create C# like event handlers for JavaScript classes and finally, I’ve done it. Please let me know of any bugs and suggestions to improve this context menu control.
  • So this is my solution. If you have some other ideas about this functionality, please share them with me.
  • I have tried my best to make this code error free. Suggestions and criticism for further improvements of this code are most welcome.
  • So this is the approach that I've adopted to solve the Hover Delay problem. Although originally I developed Hover Delay to deactivate the click event for 1 second on a GridView row, later I also used Hover Delay to deactivate Drag n Drop of GridView rows. Kindly let me know if any one has some other better or different solution.
  • In this article I will explain how to import data from EXCEL to SQL in ASP.NET . In many situations we have data in the form of excel sheet but we have the requirement to have that data in SQL SERVER DB. I have explained importing data both from Excel 97-2003 as well as Excel 2007 format.
  • The source code shows how to use Regular Expressions in C#. The code Functions written for Validation Alphabet, AlphaNumeric, Integer, Postive Integer, Floating point numbers. You just cut copy these functions and use in any program.
  • That’s all about this technique. Just download the sample application and happy CSS! I have tested this application on various browsers and it worked fine.
  • This script is cross-browser compatible and fast as it iterates elements of a specific tag inside a target element [GridView] rather than iterating in a whole form. It searches the elements of a specific type in a particular column of the target element [GridView].
  • This Article is used to insert a numeric value on the sever control(text box) This is a java script code for the the client side validation. On Page Load Event You can change the events in txtNoOfQuestion.Attributes.Add("onkeypress", "return numericOnly(this);"); like onfocus events like other according to needs.
  • I have toggled visibility of all TD elements of a GridView column in order to create an illusion of smooth dynamic effect with the help of setTimeout method through recursion. Different browsers have different effects of Expanding / Collapsing GridView Columns. In Internet Explorer 7/8, Safari, Google Chrome and Opera, it seems that columns are Exp
  • In this article, I've used the setTimeout method in order to achieve a smooth expand/collapse functionality.
  • Introduction I am going to present here a functionality that selects / deselects all checkboxes of a particular column inside a GridView control, provided the header checkbox of that column is checked or unchecked using JavaScript. This functionality also has a feature that when all checkboxes of a particular column inside the GridView are check
  • This article describes how to toggle the states of all CheckBoxes inside a particular DataGridView column.
  • This article describes how to apply client-side mouse over & mouse out effects on the GridView’s rows.