You can do this with javascript. First create an anchor tag with href having a fake firstname value:
<a href="@Url.Action("Search", "Controller", new {firstname="xxxx"}") id="lnk">Search</a>
Also, generate an identifier (i.e. txtSearch).
Then, using javascript, you can attach the click event of this. Using jQuery code will look something like this:
$("#lnk").click(function(evt) { var fakedUri = $("#lnk").prop("href"); var uri = fakedUri.replace("xxxx", $("#txtSearch").val()); });
Hello!
source share