In an MVC project I'm trying to create an HTML image button that will redirect to an ActionResult. It's a search box.
Currently I just have something like this:
<input type="text" id="Text1" name="seachKeyword" class="searchTextBox" value="Search" style="color:blue; " onfocus="this.value==this.defaultValue?this.value='':null"/>
and for the button:
<input type="image" src="somesrc" width="100" height="100" class="aaa" value="something" alt="something" />
And I want to replace it with some combination of these two things: first thing, to make the button a link button and not a submit button. I want to take the keyword from the search text box and send it to the search controller:
<a href="somehow redirect to the search controller with the textbox value">
<img src="somesrc" alt="something" width="100" height="100" />
</a>
this is how it works now. Should be somehow combined in the above code.
[HttpPost]
public ActionResult Index(string id)
{
return RedirectToAction("Search", "Something", new { keyword = id, pageNumber = 1 });
}