Geeks With Blogs

News

Steve Clements .Net and then some....

If you are using MVC it might be worth checking out the telerik controls (http://demos.telerik.com/aspnet-mvc), they are free if you are doing an internal or “not for profit” application.

If however you do choose to use them, you could come up against a little problem I had.  Using the telerik controls with your own custom jQuery.  In my case I was using the jQuery UI dialog.

It kept throwing an error where I was setting my div to a dialog.

Code Snippet
  1. $("#textdialog").dialog({

The problem is when you use the telerik mvc stuff you need to call ScriptRegistrar

Code Snippet
  1. @Html.Telerik().ScriptRegistrar()

in order to setup the javascript for the controls.

By default this adds a reference to jQuery and if you have already added a reference to jQuery because you are using it elsewhere, this causes a problem.

I found the solution here

And it was to change the above ScriptRegistrar call to this…

Code Snippet
  1. @Html.Telerik().ScriptRegistrar().jQuery(false).DefaultGroup(g => g.Combined(true).Compress(true));

 

If you come across this one on stackoverflow it wont work – in my case the HtmlEditor would render no problem, but was unusable.  Which is the same as someone else found when using the tab control – they went to the bother of re-writing the ScriptRegistrar.  Not for me that one!!

Posted on Wednesday, January 5, 2011 3:11 AM .NET , ASP.net , ASP.net MVC , .NET 4.0 | Back to top


Comments on this post: Using Telerik MVC with your own custom jQuery and or other plug-ins

# re: Using Telerik MVC with your own custom jQuery and or other plug-ins
Requesting Gravatar...
Finally!! Thank You.. I spent like hours trying to figure out why my jquery plugin wont work.. Wish I had come across your post earlier.. would have saved me a good amount of time
Left by Parag Nair on Jun 29, 2011 10:03 AM

# re: Using Telerik MVC with your own custom jQuery and or other plug-ins
Requesting Gravatar...
Thanks a lot for this very helpful tip. Worked like a charm for me!
Left by Stephan Kühn on Nov 15, 2011 6:10 PM

Your comment:
 (will show your gravatar)


Copyright © Steve Clements | Powered by: GeeksWithBlogs.net