Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
4.16/5 (5 votes)
See more:
i am new to mvc5.. i tried simple appl. to display datepicker dialog when textbox is focused. but it is not working.pls help me to fix the issue..

this is view:

    ViewBag.Title = "Index";


<script src="~/Scripts/bootstrap-datepicker.js"></script>
<link href="~/Content/bootstrap-datepicker.css" rel="stylesheet" />

<input type="text" class="dp" />

<script type="text/javascript">
    $(function () {


Layout page:

<!DOCTYPE html>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="~/Scripts/modernizr-2.6.2.js"></script>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <link href="~/Content/themes/ui-lightness/jquery-ui.css" rel="stylesheet" />
    <title>@ViewBag.Title - My ASP.NET Application</title>

    <div class="navbar navbar-inverse navbar-fixed-top">
    <div class="container body-content">
        <hr />
            <p>© @DateTime.Now.Year - My ASP.NET Application</p>
    @RenderSection("scripts", required: false)
Updated 21-Oct-14 19:41pm

For that you have to add jQuery UI script into your project after including jquery.js
you can download at following link[^]
Share this answer

This is a simple fiddle in which i have used Jquery version 1.9.*
What I think is you are missing the jquery-ui version reference.
Check the fiddle.
I hope this helps.
Share this answer
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900