0
如何在Drupal中添加一個搜索框到ASP MVC 5應用程序來搜索所有網站?我是新來的ASP MVC,在Drupal中經驗豐富。如何添加像Drupal中的搜索框到ASP MVC 5應用程序來搜索所有網站?
如何在Drupal中添加一個搜索框到ASP MVC 5應用程序來搜索所有網站?我是新來的ASP MVC,在Drupal中經驗豐富。如何添加像Drupal中的搜索框到ASP MVC 5應用程序來搜索所有網站?
你有下面的代碼添加搜索選項:
首先,你需要以下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> 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>
的可能的複製[如何設計Layout.cshtml的MVC5全局搜索功能(http://stackoverflow.com/questions/37306604/how-to-design-an-mvc5-全局搜索功能的佈局,CSHTML) –