This may be a silly question and is more of a question about how to do something rather than an actual coding issue.
I want to have a partial view which contains a searc
First of all you need to create partial view under shared folder with name _SearchBox.schtml. It can be something like this:
@model IEnumerable
@using (Html.BeginForm("MakeSearch", "SearchController", FormMethod.Get))
{
}
Then you can call it from any view by calling
@{Html.RenderPartial("_SearchBox", listOfSupplies);}
Otherwise you can create action in controller if wish to get supplies from DB and you don't have a list of supplies on your parent view.
[ChildActionOnlyAttribute]
public ActionResult _SearchBox()
{
var supplies= _service.GetSupplies();
PartialView(supplies);
}
and call it from view:
@{ Html.RenderAction("_SearchBox", "Search"); }