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

problem in connecting to server

java mysql jdbc

C:\Users\shilps\Desktop&gt;set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_22\bin

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.