Another newbie with ASP.NET MVC! All I intend to do is search for a text field on my page, if I type and click on search, the URL to be redirected should have the following at the end, for example, in stackoverflow,
/search?q=searchedtext
So here is what I have,
<input id="searchText" maxlength="100" type="text" name="query" />
<a href="???" class="searchButton">
Search
</a>
I have a function in my controller, for example,
public ActionResult Search(string query)
{
}
Here is the route
routes.MapRoute(
"Search",
"Search",
new { controller = "Posts", action = "Search"}
);
Can anyone fill in the blanks here :). Any comments appreciated.
source
share