Jquery datepicker doesn't show

This is sample code. On load i can see dateofbirth changing to 08-06-1990 but on clicking the textbox the datepicker is not shown. The layout.cshtml contains following

<script src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/jquery-ui-1.8.20.js"></script>  

and i can see they are loaded in firebug.I have removed the EditorFor and have instead used just of testing. Any idea.

@model SMS.Model.Student

@{
    ViewBag.Title = "Edit";
}

<script type="text/javascript">
    $(document).ready(function(){
        $('#DateofBirth').val("08-06-1990");
        $('#DateofBirth').datepicker();
    });
</script>


<h2>Edit</h2>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Student</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.RegistrationNo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RegistrationNo)
            @Html.ValidationMessageFor(model => model.RegistrationNo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DateofBirth)
        </div>

        <input  id="DateofBirth" value="07-06-1990" />

        <p>
            <input  type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

Answers


It works now. I noticed that my layout.cshtml had

 @Scripts.Render("~/bundles/jquery")
 @RenderSection("scripts", required: false)

in the body section and i was explicitly referencing the jquery and jquery ui using loading the the jquery file twice causing this issue. I removed this from header

<script src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/jquery-ui-1.8.20.js"></script>

and moved

@Scripts.Render("~/bundles/jquery")

to header and added jqueryui to the header. It works perfectly.

@Scripts.Render("~/bundles/jqueryui")

Need Your Help

How can I stop cURL from using 100 Continue?

php jquery curl proxy

So, long story short, I have an AJAX application that uses MVC Web API as the back end. The client however calls from a different domain and uses a PHP proxy file to get around cross-domain request

Create the XML files that are in a powerpoint presentation?

javascript xml powerpoint

A MS powerpoint (.pptx) presenation is essentially a zip of a bunch of XML files.