SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom list called expenses. The list has fields such as user,date,amount etc.

I want the user to be able to filter this list by amount e.g. add a dropdown above the list with a search button and these items 'Below 10', 'Above 10', 'Above 50 etc'

This has to be done in visual studio as i am creating a web template.

How would i go about implementing this?

share|improve this question
up vote 0 down vote accepted

You can do this in several ways.

One of them would be to declaratively create a List Definition which contains a View with the filters that you need (you can even make it the default view if required).

Here's a walkthrough on creating list definitions:

Another option would be to programmatically create the View in a new or existing list. Here's an example on how to add a View to a list:

As I mentioned, you can either programmatically create the list and add the view, or you can just get an existing list an add the view.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.