views:

44

answers:

2

i have a ajaxified list page showing some list of items i am using a user control for filtering the content of the list page there are multiple filters in the user control what i want is if a user applied more than one filter than navigate to other page and press the back button the applied filters should be there in active state. can any one please suggest me something how to achieve this.

A: 

One way is using cookies.

Store the values in a cookie, and read them back with javascript when the user hits the back button.

Or use the querystring like @Danny says. Why didn't I think of that right away :)

Mikael Svenson
+4  A: 

You should put the filters in the query string because:

(1)It's not secret data.

(2)When user click "back" button of the browser, of course he wants the list is well-filtered, instead of that he need to filter the list again. Also sometimes he may copy the url in the address bar and sent it to others.

Format the filters' info in a proper way, e.g. "filter1=name&filter2=price", and deal with the query string in Page_Load if there is a filter.

Danny Chen
+1 for point #2. Abide by HTTP/REST principles. (e.g a GET should always be bookmarkable and return the same HTML result everytime).
RPM1984
the filter page is ajaxified how to use query string
Mac