Search code examples
asp.net-mvc-3jquery-uiasp.net-mvc-3-areas

jquery datepicker not working ,date box not appearing?


I try to use jQueryUIHelpers.Mvc3 but when i click on the box the datebox picker not appear. I installed the jqueryUIHelpers.Mvc 3 package like here http://jqueryuihelpers.apphb.com/Docmo/Overview/GettingStarted But when i am running the page and click the date box nothing appears. Here is my view:

           @model MvcApplication4.Models.Reservation
          @using JQueryUIHelpers
          @{
         ViewBag.Title = "Create";
                }
        <head>
       <h2>Create</h2>
           <title>jQuery UI Helpers - @ViewBag.Title</title>

                 <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
             <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

          <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
       <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />       
      <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
      <script src="@Url.Content("~/Scripts/jquery-ui-1.8.18.min.js")" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/jquery-ui.unobtrusive.min.js")" type="text/javascript"></script>   
         </head>

       @using (Html.BeginForm()) {
     @Html.ValidationSummary(true)
<fieldset>
    <legend>Reservation</legend>

    <div>
                            <label for="anotherDate">Select another date: </label>
                                                                                                   @(Html.JQueryUI().Datepicker("anotherDate").MinDate(DateTime.Today).ShowButtonPanel(true)
      .ChangeYear(true).ChangeMonth(true).NumberOfMonths(2))
    </div>

Solution

  • May be it is because you have called jquery after the validate js and an error occurred and script stopped functioning. Check your error console and include jquery-1.7.1.min.js before all other jquery plugin js and try again. I didnt find any error in the datepicker initialisation function.