ASP.NET MVC 4, VS 2012 and the Usage of jQuery UI

It took really some time to get the ASP.NET MVC jQuery sample on ASP.NET running.

At the time of writing, the sample was based on MVC 3, while I was working with MVC 4. Well, not a big deal, just change the name of some .css and .js files. But that doesn’t made it work. Starting the app, there was always an error indicating the datepicker function was unkown. And of course, the datepicker was not shown.

The solution was, as almost always, quite simple. For whatever reason, the _Layout.cshtml file generated by VS 2012 when creating an ASP.NET MVC 4 project, contains the following line at the bottom:


Removing this line made the jQuery UI parts work. Of course one should not forget to include the jQuery script and .css files into the header section of the layout file or move that line up there.