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?

1 Answer 1


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: http://msdn.microsoft.com/en-us/library/gg276355.aspx

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: http://sarangasl.blogspot.com.ar/2009/12/create-sharepoint-list-view.html

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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