Datepicker ERROR 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'datepicker'

1

I have some problem when i want to put datetimepicker into textbox in cshtml page

my bundleconfig look like this

  bundles.Add(new ScriptBundle("~/js").Include(
                "~/Content/bower_components/jquery/dist/jquery.min.js",
                "~/Content/bower_components/bootstrap/dist/js/bootstrap.min.js",
                "~/Content/bower_components/metisMenu/dist/metisMenu.min.js",
                "~/Scripts/jquery-1.9.1.js",
                "~/Scripts/jquery-1.9.1.min.js",
                "~/Scripts/jquery-ui.js",
                "~/Scripts/jquery-ui.min.js",
                "~/Scripts/jquery-migrate-{version}.js",
                "~/Scripts/site.js",
                "~/Scripts/jquery.validate.js",
                "~/scripts/jquery.validate.unobtrusive.js",
                "~/Scripts/jquery.validate.unobtrusive-custom-for-bootstrap.js"  
                ));

And i believe that the problem is in the rendering order

My layout page looks like below

<html lang="en">
<head>
    <meta charset="utf-8">
    <title>@ViewBag.Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="@Styles.Url("~/content/css")" rel="stylesheet"/>    
    <link href="@Styles.Url("~/Content/jquery-ui.min.css")" rel="stylesheet"/>
    @RenderSection("csst", false)

    @RenderSection("head", required: false)
    @Html.Partial("_html5shiv")
    @* favicons and touch icons go here *@

</head>
<body>
     @RenderBody()


    @Scripts.Render("~/js")

    @RenderSection("Scripts", required: false)


</body>
</html>

And in my view i want to add something like this

@using (Html.BeginForm())
{
  <input type='text' data-provide="datepicker" class="form-control" id='txtBirthDateSU' />
}

@section Scripts {

<script type="text/javascript">

    $(document).ready(function () {
        $("#txtBirthDateSU").datepicker();
    });
</script>
    @System.Web.Optimization.Scripts.Render("~/bundles/jqueryval")

}
jquery
asp.net
asp.net-mvc-4
asked on Stack Overflow May 27, 2015 by Taulant Racaj • edited May 27, 2015 by John Saunders

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0