【问题标题】:Tring to implement bootstrap.chosen in MVC 5 Razor Page在 MVC 5 Razor 页面中实现 bootstrap.chosen
【发布时间】:2021-08-16 05:57:57
【问题描述】:

我已经在我的 web 项目中安装了 bootstrap.chosen 并且正在尝试实现它。

捆绑配置

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-{version}.js",
                "~/Scripts/chosen.jquery.js"));

    bundles.Add(new StyleBundle("~/Content/css").Include(
              "~/Content/bootstrap.css",
              "~/Content/bootstrap-chosen.css",
              "~/Content/site.css"));

_Layout.cshtml

(Top) @Styles.Render("~/Content/css")
      @Scripts.Render("~/bundles/modernizr")

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

在我的剃须刀页面中,我有以下内容

@Html.DropDownListFor(model => model.HASSForm.HASS_District_Id, new SelectList(Model.HASSDistricts, "Id", "ENGL_NAME"), new { htmlAttributes = new { @class = "form-control chosen-select" } })

在页面底部我有以下内容

@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
    $(function () {
        $(".chosen-select").chosen();
    });
</script>
}

我希望下拉菜单可以通过搜索框呈现,但我只能得到常规的下拉列表。

如果有人可以帮助我,将不胜感激。

【问题讨论】:

    标签: asp.net-mvc bootstrap-4 jquery-chosen


    【解决方案1】:

    我建议从头开始项目,有一个有用的video。

    我将示例解决方案推送到bitbucket。

    【讨论】:

      猜你喜欢
      • 2020-12-22
      • 2017-01-28
      • 2019-05-01
      • 2016-02-25
      • 2017-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-21
      相关资源
      最近更新 更多