Summary

A filter web part for SharePoint 2010 showing a list of months whose selected value may be provided to other connected web parts (such as an SSRS 2008 Report Viewer web part). The list of dates is dynamic to keep pace with the current date.

Project Description

The Month Filter Web Part is a date selection filter that serves as a connection provider for other web parts on a SharePoint page. The web part lists a series of descending months which dynamically update in relation to the current date. This is accomplished by configuring the web part properties to automatically increment at preset offset values. For example, the starting month (i.e first month in the list) can be configured to always start with a month that is one month greater than the current month. The default (i.e. date first shown in the text area of the dropdown list) may be set in the same way using a DefaultOffset property. As time passes, the list of available dates will advance in coordination so that the dates shown are always ‘up to date’. The total number of months shown in the list may also be changed; the default is twelve months.

Month Filter with drop down list expanded.

The web part serves as a filter by being a connection provider to other web parts on a SharePoint web part page. The control provides a dropdown list of dates from which a user may make a date selection. After a selection has been made, the page performs a postback to refresh the content of the page. Web parts that are connected to the Month Filter Web Part will consume the selected date for their specific purposes. The connection type is compatible with the SharePoint Server Reporting Server (SSRS) 2008 Report Viewer web part and any other web parts that can accept connections based on the ITransformableFilterValues interface.

The web part may be edited to affect nearly every aspect of its appearance. First, the label shown with the text “Select a date:” may be modified, the date format displayed in the dropdown list may be changed, and the styles (i.e. inline css styles) may be modified for the container, the label text and the dropdown list.

In addition to setting the default date shown using the configured offset value, the default date may also be set using a QueryString parameter. When the page initially loads it will check the QueryString for a predefined parameter name and set the date initially displayed in the dropdown list to the date value.

Last edited May 11, 2011 at 1:33 PM by samuelsethhildebr, version 8