Share via


How to connect Filter Web Parts

There an excellent post on this blog (https://blogs.msdn.com/edhild/archive/2007/04/17/how-to-connect-web-parts-during-site-provisioning.aspx) about how to connect Web Parts in sharepoint.  With a little change you can connect filters using the same technique.

here's a sample.  I had runtime errors for duplicate connection from the code in the blog entry from edhild when i called mgr.SPWebPartConnections.Add(conn);.
This line is not neccessary since mgr.SPConnectWebParts already adds the connections.

 asp.ProviderConnectionPointCollection providerConnection = mgr.GetProviderConnectionPoints(filterWebPart);

 wss.TransformableFilterValuesToFilterValuesTransformer transformer = new wss.TransformableFilterValuesToFilterValuesTransformer();
 transformer.MappedConsumerParameterName = "ParameterName";

 wss.SPWebPartConnection conn = mgr.SPConnectWebParts(
                                   filterPart,
                                    providerConnection["ITransformableFilterValues"],
                                    consumerParts[j],
                                    consumerConnection["ReportParameters"],
                                    transformer
                                    );

Comments