views:

75

answers:

0

I'm creating an action that will retrieve database records and filter these results based on one or more industries selected by the user using checkboxes. The form method is set to "get" and each checkbox has the same name. As a result, the querystring has a key/value pair for each selected industry id and I'm getting these IDs into the action via a List. For paging I'm also using get (by passing an integer to the action).

In order to maintain filter parameters on new pages I had intended to recreate the querystring using a RouteValueDictionary and attach it to each paging link. The problem with this approach is that there could be multiple querystring parameters with the same key values (because all checkboxes have the same name) which will throw an exception.

Is there a better way of using get with multiple checkboxes and preserving these filters across multiple pages? Alternatively, is there a completely different strategy that I should consider using? I'm not too concerned about being able to save a link to the search.