无法激活MVC 5 Visual Studio 2015中的Bootstrap Datapicker



我正在尝试激活一个字段的数据键,但这只是没有发生。

bundleconfig.cs:

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                  "~/Scripts/bootstrap.js",
                  "~/Scripts/moment.js",
                  "~/Scripts/bootstrap-datetimepicker.js",
                  "~/Scripts/respond.js"));
        bundles.Add(new StyleBundle("~/Content/css").Include(
                  "~/Content/bootstrap.css",
                  "~/Content/bootstrap-datetimepicker.css",
                  "~/Content/site.css"));

_layout.html:

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

scriptss 文件夹中创建一个datepickerready.js:

$(function () {
$('.datetimepicker').datepicker();

});

,最后是我希望datepicker可用的 view

<div class="form-group">
        @Html.LabelFor(model => model.Achizitionare, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Achizitionare, new { htmlAttributes = new { @class = "form-control datetimepicker" } })
            @Html.ValidationMessageFor(model => model.Achizitionare, "", new { @class = "text-danger" })
        </div>
    </div>

我在做什么错?

找到了解决方案:忘了致电datepickerready.js

最新更新