ASP.NET Ajax Controls and jQuery - What about IntelliSense?

by ASP.NET AJAX Team | Comments 10

  UPDATE: Please see this blog post for updated instructions on enabling IntelliSense in the Q1 '09 version.

We have recently announced that we are shipping jQuery with RadControls for ASP.NET Ajax. You can use this completely unmodified version of jQuery in your projects, as long as you have the RadControls assembly in your bin folder. This way you do not have to include jQuery and this can translate into 50kB less traffic.

You can enable IntelliSense, just like with the standalone jQuery, in VS2008 with a few simple steps.

1. Install the Visual Studio 2008 IntelliSense patch, if you have not already done so.

2. Download the jQuery IntelliSense documentation file and add it to your project. Rename it to jquery-telerik-vsdoc.js

3. Add a new file to your project, jquery-telerik.js, with the following content:

var jQuery = window.jQuery = window.$ = $telerik.$;

This will make jQuery accessible under its default alias - $.

Edit: Make sure that both jquery-telerik.js and jquery-telerik-vsdoc.js are in the same folder.

4. Add script references for jQuery and the jquery-telerik.js file in the ScriptManager on the page:

<asp:ScriptManager ID="ScriptManager" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Path="~/jquery-telerik.js" />
</Scripts>
</asp:ScriptManager>

 

And that is just about it. You can start using jQuery, as you normally would, with full IntelliSense support.

You will find a reference web site attached to this blog post.

Have a great day.

WebUI_jQuery.zip

About the author

Iana Tsolova

Iana Tsolova

is Program Manager of Telerik’s ASP.NET AJAX division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.

10 Comments

chris
A few questions...

Telerik client code access this embedded version of jQuery with $telerik.$ ?

If we are using jQuery already there will be no conflict, other than its loaded twice into browser memory?

If we do the above instructions, we don't have to ship our own jQuery, we can use the embedded one on any page with a script manager?

Will Telerik normally ship with most recent top stable jQuery version?

Thanks
Tsvetomir Tsonev
Very good questions, Chris. Thanks for asking.

This is correct, we use the $telerik.$ alias to access jQuery internally.  It will not conflict with other jQuery instances on the page, but there will be some extra network traffic that can be avoided.

Yes, you can use the embedded jQuery instead of the standalone version. We will update it to the latest official jQuery version on each RadControls release.

Tsvetomir Tsonev
Visual Studio will take care of it. You do not need to explicitly reference it anywhere. Just place it in the same folder as jquery-telerik.js and it will load the API reference from it.
ethan
I tried this using a telerik:RadScriptManger, and although the JQuery library is included and can be used, there is no Intellisense unless I use an asp:ScriptManger. Any reason why the RadScriptManager doesn't support intellisense?
Tsvetomir Tsonev
@Stas - I believe the reference is correct. The -vsdoc file will be included automatically by VS.

@ethan - You're correct, IntelliSense doesn't seem to work with RadScriptManager. We'll look into this issue.
Matt
Did anyone solve the intellisense issue with this?

Is there any newer documentation about the telerik/jquery integration I can look at, I am currently linking in a seperate jquery file to the telerik one + all works fine, and would like to save on the double download :)

Thanks,
Matt
Armin
And how can I reference the JQuery Library when Telerik.Web.UI.dll was dropped in GAC?
Stefan
You can review the latest support resources below concerning jQuery and RadControls for ASP.NET AJAX JavaScript IntelliSense, guys:

http://www.telerik.com/help/aspnet-ajax/jquery-intellisense.html

http://blogs.telerik.com/stefanrahnev/posts/10-03-01/radcontrols_for_asp_net_ajax_q1_2010_release_comes_with_native_net_4_builds_and_javascript_intellisense_in_vs_2008_2010.aspx

Comments

  1.    
      
      
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)
Read more articles by ASP.NET AJAX Team - or - read latest articles in Developer Tools