user560498
user560498

Reputation: 547

retain query string between actions

My controller has three actions: Inroduction, Index and category. In my master page I have a text box and a search button. The general idea is that the user reaches the Introduction view, then types text into the textbox and clicks the search button. He then sees the Index view, while the query string holds a value by which the data the user sees is filtered. the user can choose a category and then he is redirected to the category view. How can I maintain the query string field and value (let's say "?cities=1,2,3") when I move between the actions Introduction, Index and category ? I'll just point out that the query string value will change if the user enters new text in the textbox.

Upvotes: 0

Views: 713

Answers (2)

3Dave
3Dave

Reputation: 29041

Assuming you mean that the user clicks a link (as opposed to a server-side redirect), your best bet is to convert the querystring values to hidden fields.

See this thread.

Upvotes: 0

Matt Wrock
Matt Wrock

Reputation: 6640

One approach would be to persist the initial qs values in a hidden form field. This will work as long as the user navigates from action to action using form submits. Another method which would not require form submits would be to persist to a cookie.

Upvotes: 2

Related Questions