I recently started developing an application in Visual Studio 2013 using MVC. I am currently working on implementing a jquery datepicker to show up whenever there is a DateTime field involved. My controllers are being created through scaffolding templates.
- I have already imported the JQuery UI (combined Library).
- In the BundleConfig.css, I included "~/Content/themes/base/all.css" in the bundles.Add(new StyleBundle("~/Content/css").Include
Furthermore, I added a new bundle --
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( "~/Scripts/jquery-ui-{version}.js));
In the _Layout.cshtml, I added 2 new Scripts.Render
@Scripts.Render("~/bundles/jqueryui") @Scripts.Render("~/Scripts/AQB_MON.js")
I created AQB_MON.js with the following content
$(document).ready(function(){ $(".input[type='datetime']").each(function(){ $(this).datepicker(); }); })
However, despite all my efforts, the datetime fields are not being affected by the implementation of the datepicker. Could this be due to using scaffolding for creating Controllers/Views? I encountered issues while trying to use ToShortDateString() when displaying my datetime fields which were built through scaffolding.