Use textbox value on submit as a query string variable

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2011-01-12T19:34:31Z Indexed on 2011/01/12 20:53 UTC
Read the original article Hit count: 146

Filed under:
|

How would I take a text box value and use it in the query string on submit? I'd like it to start as this,

/News?favorites=True

and end up something like this after the user enters in a search and clicks search.

/News?query=test&favorites=True

The controller action looks like this

public ActionResult Index(string query,bool favorites)
{
   //search code   
}

This question is something close to what I'd like to do, but I'd like to use the query string and maintain the existing values in the query string.

Thanks.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc