How do you customize a url for a form with Asp MVC?
- by Maudite
I am adding a search box to a Asp Mvc.
This is html for the form:
@using (Html.BeginForm("Query", "Search", FormMethod.Get))
{
<input type="text" name="q" />
<input type="submit" value="Seach" />
}
and I added this route
routes.MapRoute("Search", "q={query}",
new { controller = "Search", action = "Query" });
I would like the form to generate a url that looks like http://localhost:####/q=value in textbox.
Is it possible to change the way MVC generates the url? This is currently what I get:
http://localhost:50916/Search/Query?q=value in textbox