微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的可搜索下拉列表视图不起作用 asp.net mvc

如何解决我的可搜索下拉列表视图不起作用 asp.net mvc

他是我从 Nugget 包“bootstrap.Chosen”下载的。我也在使用“@Html.DropDownListFor”。我也为 jQuery 设置了 id。一切看起来都正确,但它无法在我的下拉列表中找到搜索栏。我的代码如下。

        <div class="form-group">
        @Html.LabelFor(m => m.Messageto,htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.DropDownListFor(m => m.Messageto,(SelectList)ViewBag.Employeelist,new { id = 
               "Dropdown" }) //I setup Id for using jQuery.
        </div>
        </div>

        @section Scripts{
          <script>
              $(function () {
                $("#Dropdown").chosen();
            });
          </script>
          }

我还设置了布局页面

      @Styles.Render("~/Content/css")
      @RenderSection("scripts",required: false)
      <script src="~/Scripts/chosen.jquery.min.js"></script>
      <link href="~/Content/bootstrap-chosen.css" rel="stylesheet" />

我不知道为什么我的下拉列表中不能使用搜索栏。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。