I have a partial view that is a search textbox and button.
I am trying to make it a partial view so that I can render it in several places. When the user clicks search I want it to redirect to /Home/Search which will show a list of items based on what was put into the search box.
Is this the right approach or should I make the form just run the /Home/Search Index() action and not have a partial view controller at all?
Partial View
<% using (Html.BeginForm("Search", "SearchBox")) {%>
<%: Html.TextBoxFor(model => model.searchTerm) %>
<input type="submit" value="Search" />
<% } %>
Partial View Controller
public class SearchBoxController : Controller
{
public ActionResult Search(ViewModels.SearchViewModel item)
{
Models.DataClasses1DataContext db = new Models.DataClasses1DataContext();
List<Models.Item> retVal = (from p in db.Items
where p.Name.Contains(item.searchTerm)
select p).ToList();
return RedirectToAction("Search", "Home"); //No data... What to do????
}
}