ASP.NET MVC Search Box on Layout.cshtml

asp.net-mvc

Solution

put a from contains a Text box and a button and the form's action will be the search action

Ex code in the `_layout.cshtml` page

@using(Html.BeginForm("ActionName","ControllerName", FormMethod.Get))
{
    @Html.TextBoxFor(m => m.Query)

    <div>
        <input type="submit" value="Search" />
    </div>
}

Problem

I've created the search form and results from http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application which handles paging and sorting using the PagedList Nuget package. What I need help with though, is how do I put the search form on my master page? (_layout.cshtml)?

Original source