Changing scripts folder in MVC application and using Telerik MVC Extensions


I am using the Telerik MVC Extensions and have moved my Scripts folder in to the Content folder. So instead of ...

<script src="<%= Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>

... I now have ...

<script src="<%= Url.Content("~/Content/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>

I realise that I can turn off jQuery inclusion with the ScriptRegistrar().jQuery(false) method, but how to I tell the Telerik MVC Extensions where the new "base" folder is?


You cannot set a <em>base</em> folder <strong>through the API</strong>, you either follow the MVC convention or you insert your scripts manually. You can, of course, edit the code of the extensions and modify the places where the ScriptRegistrar looks for them, in the <a href="http://www.telerik.com/help/aspnet-mvc/allmembers_t_telerik_web_mvc_webassetdefaultsettings.html" rel="nofollow">WebAssetDefaultSettings class</a>.

That said, do you really need the scripts in the Content folder?


I'm not sure what version of the Telerik MVC extensions it came with, but you can call <a href="http://www.telerik.com/help/aspnet-mvc/web-assets-working-with-javascript-web-assets.html#ChangeDefaultPath" rel="nofollow">DefaultPath()</a> on the default group to change the base directory:

<%= Html.Telerik().ScriptRegistrar() .DefaultGroup(g => g.DefaultPath("~/Content/Scripts") .Add("Main.js")) %>


Since the code formatting is, well not there in the comments, here is my code ...

public class MvcApplication : System.Web.HttpApplication, IContainerAccessor { ... protected void Application_Start() { ... WebAssetDefaultSettings.ScriptFilesPath = "~/Content/Scripts"; } ... }


  • Python - Convenient way to check for a value in a list that is part of a dictionary?
  • Selecting elements with lodash where inner properties match values in an array
  • Can I configure Jackson JSON pretty printing from annotations or from Spring MVC controller?
  • Can I deploy Python .pyc files only to Google App Engine?
  • Does a SQL Server Computed Column require “persistence” in order for it to be indexed efficiently?
  • Core Data vs SQLite [closed]
  • Storing a copy of a document embedded in another document in MongoDB via Mongoose
  • Access the state of control in Winforms from another application
  • jQuery ready not fired after rails link_to is clicked
  • How to attach a node.js readable stream to a Sendgrid email?
  • Cannot resolve symbol 'MyApi'
  • HTML download movie download link
  • Updating server-side rendering client-side
  • MySQL WHERE-condition in procedure ignored
  • Hazelcast - OperationTimeoutException
  • How to make Safari send if-modified-since header?
  • Adding custom controls to a full screen movie
  • jQuery tmpl and DataLink beta
  • Web-crawler for facebook in python
  • RestKit - RKRequestDelegate does not exist
  • How to disable jQuery.jplayer autoplay?
  • Revoking OAuth Access Token Results in 404 Not Found
  • trying to dynamically update Highchart column chart but series undefined
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • How to set the response of a form post action to a iframe source?
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How do I configure my settings file to work with unit tests?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can I remove ASP.NET Designer.cs files?
  • reshape alternating columns in less time and using less memory
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal