Tuesday, October 18, 2011

Telerik MVC Extensions: Using a more recent jQuery version

If you are looking for custom ASP.NET MVC controls, the Telerik MVC Extensions are one of the options. If you are using them you probably included them in your ASP.NET MVC web application by using NuGet. These extension are jQuery based and jQuery 1.5.1 is included out of the box.
Including the required Javascript files is easy. Just at the following code to the bottom of your Razor page(your Telerik controls should be placed BEFORE the scripts).
@(Html.Telerik().ScriptRegistrar()) 

This will include jQuery and all other required Javascript files automatically. But what if you are using a more recent jQuery version? I first removed the jQuery script from the Scripts\2011.2.712\ folder but this resulted in errors. Instead what you need to do is change your script as follows:


@(Html.Telerik().ScriptRegistrar() 
   .jQuery(false) 
) 

The ScriptRegistrar will no longer complain and you can reference the jQuery version of your choice. I tried it with jQuery 1.6.2 and everything worked fine.

1 comment:

Anonymous said...

Thanks, this helped me quite a bit