Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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: 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.

share|improve this answer
add comment

Your Answer

 
discard

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.