Hi could someone make a small example for me.
I wanna create a partial view with a textbox and a submit button. When the user hits the submit button, I want to redirect to the following url
/Search/SearchQuery/
UPDATE
//This is my searchBox.ascx
<% using (Html.BeginForm("Index", "Search", new { area = "eCommerce" }, FormMethod.Post, new { searchTerm = "searchTerm" })) %>
<% { %>
<input name="searchTerm" type="search" results="5" placeholder="Product search" autofocus />
<input type="submit" value="Search">
<% } %>
And here is my SearchController
public string Index(string searchTerm)
{
return "your search term was "+ searchTerm;
}
And finally my MapRoute
context.MapRoute(
"Search",
"Search/{searchTerm}/",
new { controller = "Search", action = "Index", searchTerm = UrlParameter.Optional }
);
Now its possible to use /Search/searcTerm/ but when I use my searchBox it just redirects /Search but my SearchController returns "your search term was test"