1

I would like to build a search functionality for ASP.NET my website similar to those that can be found in many clothing shops. For instance in footlocker website once you choose the items "shoes" you have on the left pane:

  1. All the attributes applicable to shoes, such as brand, size, color, etc...

  2. Their values (size 42, 43, 44, etc..)

  3. The amount of results you get if you refine the search for a specific value of the attribute (8 results for 43 size, 5 for 42, etc..)

The calculation of the results of course depends on which combination of attributes-value the user choose, for instance color:black and size:42 might give a different amount of results then just color:black.

I would like to know how this technique is called and eventually have some resources on the Internet or books to study. Thanks

CiccioMiami
  • 8,028
  • 32
  • 90
  • 151

1 Answers1

1

They probably use ajax calls to the server which return json. Json is parsed by javascript on the client side and the view is refreshed. Now you can do it in a very modern way using upshot.js and ApiController (MVC4). You would basically expose OData api that you can query (e.g. to filter only the shoes) and using upshot.js you bind the result to your view. Everything else is magic :). Unfortunately there are not many examples. Have a look here: Where can I find Upshot.js examples and documentation?

Ps. you can also obtain the same result e.g. with knockout, but you will have to return your data as json and knockout will bind it to the view. Knockout has a very good documentation here: http://knockoutjs.com/documentation/introduction.html

Good luck!

Community
  • 1
  • 1
Michal B.
  • 5,676
  • 6
  • 42
  • 70
  • thanks for your answer! Unfortunately I have to use ASP.NET web forms because the remaining functionality of the site is implemented with that technology. Is there any way to initially do it with server postbacks, just to validate its functionality – CiccioMiami Mar 12 '12 at 14:47
  • Well, you could do that with postbacks, but it's more time consuming and not as slick. Using ASP.NET Web forms you can also do ajax calls to e.g. whatever.aspx and whatever.aspx would return json based on the filter parameters. You would then use the json client side (in javascript) to update the view. That approach sounds better :). Maybe you can use some ready-to-use components that you only have to configure and then they just work. I am sure Telerik or DevExoress has something like that. Maybe there are also free solutions. – Michal B. Mar 12 '12 at 14:50
  • how would you call this technique? Dynamic filtering? – CiccioMiami Mar 12 '12 at 16:22
  • I would search for asynchronous postbacks or asynchronous gridview (assuming you present the data in a gridview). Is this http://davidhayden.com/blog/dave/archive/2007/11/29/ASPNETAJAXProgressIndicatorRealTimeSearchFunctionalityYUIStyle.aspx something you are looking for? – Michal B. Mar 12 '12 at 17:37