【问题标题】:How to add a search box like in Drupal to ASP MVC 5 app to search all site?如何将 Drupal 中的搜索框添加到 ASP MVC 5 应用程序以搜索所有站点?
【发布时间】:2016-11-17 16:12:03
【问题描述】:

如何将 Drupal 中的搜索框添加到 ASP MVC 5 应用程序以搜索所有站点?我是 ASP MVC 新手,在 Drupal 方面经验丰富。

【问题讨论】:

标签: asp.net-mvc


【解决方案1】:

您必须为搜索选项添加以下代码:

首先你需要添加以下JS文件的引用:

Download JS and CSS files for Select2 Dropdown List

<script src="~/Scripts/select2.full.min.js"></script>
<link href="~/Content/select2.min.css" rel="stylesheet" />


Download and include in your view

然后在您的视图上添加以下代码:

$(function () {
        $("#SearchBoxddl").select2({
            placeholder: "-Select Options-"
        });
  });
<div class="col-sm-4 ">
        <strong class="text-primary"><i class="fa fa-search"></i>&nbsp;Select Options</strong>
        <p class="form-static-control">
            @Html.DropDownListFor(model => model.Id, new SelectList(Model.SelectList, "Id", "Name"), "-Select Options-", new { @class = "form-control", @id = "SelectBoxddl" })
        </p>
    </div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-26
    相关资源
    最近更新 更多