ARTICLE

jQuery UI Datepicker in MVC 4 Issue

Posted by Abhimanyu K Vatsa Articles | ASP.NET MVC with C# October 28, 2012
Today, I spent couple of hours in finding the best suited fix of this issue. Actually that was a very simple problem and we may fix it by adding another http request layer in the application but that was not a productive choice.
Reader Level:

Today, I spent a couple of hours in finding the best suited fix of this issue. Actually that was a very simple problem and we may fix it by adding another http request layer in the application but that was not a productive choice.


If you create a MVC 4 application using "Internet" template, you will find the "BundleConfig.cs" file in the "App_Start" folder; open it.



You will notice there is a total of 6 bundles (jQuery and CSS) being processed. Now, open the "_Layout.cshtml" file and look at this image:



You will notice only three bundles are added by default. We have to add 2 more to enable the use of Datepicker.



Note to use the same ordering.


Now, on the view page use as follows:




Now if you run the application you will see your Datepicker working.




Hope this helps. Thanks.

Login to add your contents and source code to this article
post comment
     

Yeah its works!helpful blog

Posted by Krutika Mahabale Mar 17, 2013

Hi,I followed your steps up to the bundling part leaving out only the script in the view part as I wanted to test this first and when I run the mvc4 website, I get the following error:JavaScript critical error at line 14, column 1 in http://localhost:56152/Content/themes/base/jquery.ui.core.cssSCRIPT1002: Syntax errorIf I click on the Continue button, it will display a similar for what appears to be all the .css files located in the base folder.Any ideas what's causing this?Thanks.

Posted by Thierry Fierens Jan 30, 2013
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts