IFilterConsumer Interface
The IFilterConsumer interface is used to consume a filter expression from a Web Part that has implemented an IFilterProvider interface.
Microsoft.SharePoint.WebPartPages.Communication
Events
The following table shows the events of the IFilterConsumer interface and a brief description of each.
Name | Description |
---|---|
FilterConsumerInit | Initialization event for receiving the list of fields, and optionally field display names used to filter a list from the provider Web Part. |
Public Methods
The following table shows the methods of the IFilterConsumer interface and a brief description of each.
Name | Description |
---|---|
ClearFilter | The method for responding to a request to clear a filter from the ClearFilter Event of a provider Web Part. |
NoFilter | The method for responding to the message that no filter will be provided from the NoFilter Event of a provider Web Part. |
SetFilter | The method for responding to a request to set a filter from the SetFilter Event of a provider Web Part. |
Thread Safety
Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.
Remarks
The IFilterConsumer interface should be used with parts that need to consume a collection of one or more filter values. The event handlers of IFilterConsumer were designed for the purpose of setting and clearing multiple filter values. The IFilterConsumer part has the ability to send initialization arguments to the provider part. The IFilterConsumer can be connected to the IFilterProvider and IRowProvider interfaces. When connecting the IFilterConsumer to IFilterProvider, this is a direct connection so no transformer dialog will be displayed. To appropriately use the passed values, the consuming part may need to be designed with an understanding of the data passed by the provider. When connecting the IFilterConsumer to IRowProvider, a transformer dialog will be displayed which allows an end user to map the column in the row to the filter input. Only one value can be mapped, but it gives the end user the ability to change the filter mapping at any time. Server side implementations of IFilterConsumer can also be connected to parts on a different page by using an HTML editor compatible with Windows SharePoint Services, such as Microsoft FrontPage.
Example
The following code example shows a server-side IFilterConsumer Web Part. It can be connected to another Web Part which implements the IFilterProvider or IRowProvider interface on the server. The IFilterConsumer Web Part displays a list which can be filtered by the values sent by a provider Web Part.
There are 11 steps specific to making this a connectable Web Part. These steps are numbered and commented in the following code example.
For more information on creating a connectable Web Part, see Creating a Connectable Web Part.
Requirements
Namespace: Microsoft.SharePoint.WebPartPages.Communication
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security