开发者

ASP.NET MVC. Remember posted values between pages

In my application i have a search page where the user can search on name, postal code, sta开发者_如何学Gote, country etc. This page has a list of customers as result.

In the results screen the user can click on a customer and will be brought to the customer screen.

I want the customer screen to contain a cancel button which will take the user back to the search results.

How can i achieve this? Remembering the entered search values in a session object? Or perhaps pass them to the customer screen as hidden values?

What is a good practice for this scenario?


As you dont "edit" values, you should use HTTP GET : pass the parameters via URL, a la google. Then it becomes easy to build a cancel button, via an actionlink that takes all these parameters.


Good practice would be to make the URL RESTful, e.g describe what the content of the page the user should expect.

Use querystring values for each of the possible input values. Then on the GET action, read values and render the result.

This is both good from an SEO perspective and from a user experience perspective.

E.g:

www.yoursite.com/search?postcode=1231

www.yoursite.com/search

www.yoursite.com/search?postcode=1233&name=joe

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜