Sunday, June 30, 2013

MVC4 with jquery-ui datepicker

Here's the steps, and they're very simple.  You only have to do it this way if you want to use the built-in bundling and minification, if not you can always use the exact same code you would use in an HTML page, but you would have to comment out the bundle generation code.


  • Create a new MVC4 project and Select the Internet template. Use all default options.
  • Edit the _Layout.cshtml in ~/Views/Shared and add these two lines after the jquery bundle at the bottom
  • @Scripts.Render("~/bundles/jqueryui")
  • @Styles.Render("~/Content/themes/base/css", "~/Content/css") -- NOTE Styles.Render, not Scripts.Render as in your code
  • Either edit the Index.cshtml and delete everything, or create a new Controller action and blank view.
  • Inside the view, add the following code, Press F5 and you're done!




No comments:

Post a Comment