How to add a search box like therein in Drupal to ASP MVC 5 app to search all site? I am new to ASP MVC, experienced in Drupal.
Asked
Active
Viewed 63 times
0
-
Possible duplicate of [How to design an MVC5 Global Search feature in Layout.cshtml](http://stackoverflow.com/questions/37306604/how-to-design-an-mvc5-global-search-feature-in-layout-cshtml) – Keith.Abramo Nov 16 '16 at 17:59
1 Answers
0
You have to add below code for search options :
First you need to add reference of below JS files:
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
Then Add below code on 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>

Laxman Gite
- 2,248
- 2
- 15
- 23