In my ASP.NET MVC application I have a view that displays a list of Products in the system. I would like to implement an option for users to filter the list of Products by selecting parametes, similar to the way it's done on www.codeplex.com. I would like to know how you would go about doing this in the most efficient and simple way? Any links to tutorials or guides are appreciated.
+2
A:
In our application we load up a list of all of the products into the web page, and use the Quicksearch jQuery plugin to filter the list. This allows the user to enter a word or two into a textbox, which collapses the list to only those entries matching what the user typed.
Robert Harvey
2010-01-24 07:19:27
Very useful tool pal !
ali62b
2010-01-24 08:18:58
Any sortable tool like this ?
ali62b
2010-01-24 08:20:04
@ali62b: Have a look at TableSorter, here: http://tablesorter.com/docs/ We use both the QuickSearch and TableSorter plugins on the same page.
Robert Harvey
2010-01-24 15:59:57
Thanks for the response. Even though quick search looks like a great tool, it doesn't seem to satisfy my needs. I have a paged list of products, which refreshes the list with new items when I go to a different page number. I am looking for something more along the lines of filtering the results by parameters a la codeplex.com advanced search, when every time they select a different parameter the list is filtered
ggomez
2010-01-24 18:59:19
A:
Basically, for a search of this type (server-side), you need:
- Fields in a
<form>
for the user to fill out to perform the search request. - A button to post the form fields to your controller method
- A repository for the Linq queries that will return the proper records.
- A Method in the repository that accepts the parameters you have captured, and executes a linq query returning your filtered result, using Where clauses to filter the returned records.
- The result of the query gets returned to the view for display.
If you need dynamic capabilities (i.e. the user may omit one or more parameters, and you need the flexibility to specify those parameters in the Linq query at runtime), then have a look at Dynamic Linq.
Robert Harvey
2010-01-24 20:47:01