我想从(提供者) businessdata filter webpart向BDC列表WebPart提供"Query Value“。当我尝试连接时,我得到了fllowing错误。提供程序连接点(BusinessDataFilterWebPart)和使用者连接点"BusinessDataListWebPart“未使用相同的连接接口。
以下是我的代码片段。
System.Web.UI.WebControls.WebParts.WebPart providerWebPart =
webPartManager.WebParts[filterWebPart.ID];
ProviderConnectionPointCollection providerConnections =
webPartManager.GetProviderConnectionPoints(providerWebPart);
ProviderConnectionPoint providerConnection = null;
foreach (ProviderConnectionPoint ppoint in providerConnections)
{
if (ppoint.InterfaceType == typeof(ITransformableFilterValues))
providerConnection = ppoint;
}
System.Web.UI.WebControls.WebParts.WebPart consumerWebPart =
webPartManager.WebParts[consumer.ID];
ConsumerConnectionPointCollection consumerConnections =
webPartManager.GetConsumerConnectionPoints(consumerWebPart);
ConsumerConnectionPoint consumerConnection = null;
foreach (ConsumerConnectionPoint cpoint in consumerConnections)
{
if (cpoint.InterfaceType == typeof(IWebPartParameters))
consumerConnection = cpoint;
}
SPWebPartConnection newConnection = webPartManager.SPConnectWebParts(
providerWebPart, providerConnection, consumerWebPart, consumerConnection);发布于 2009-06-16 12:46:53
看起来您正在比较两个不同的连接接口。提供者连接实现ITransformableFilterValues,使用者连接实现IWebPartParameters。
我不太了解您在这里编写的代码,因为我很少用代码编写web部件之间的连接。但是关于连接的全部要点是使用者和提供者必须提供并期望相同的接口。
您是否尝试过在浏览器界面中将这两个web部件连接在一起?
发布于 2010-02-13 00:05:19
我在这个问题上的直接经验是,查询字符串筛选器web部件作为提供者,报表查看器web部件作为使用者,但问题是相同的。
IWebPartParameters接口不能使用ITransformableFilterValues接口。但是connection points集合中的每个项都实现不同的接口类型。
在调试器中,检查ConsumerConnectionPointCollection和ProviderConnectionPointConnection实现的其他接口类型。如果两个集合具有实现相同接口类型的连接,请在检查接口类型的foreache中使用该接口类型。
如果没有直接匹配,您应该尝试找到正确的组合。
发布于 2012-05-10 04:13:34
您需要使用正确的转换器和覆盖方法,并将转换作为参数,以便两个接口可以连接/转换。msdn文档中提到的“允许实现Microsoft.SharePoint.WebPartPages.ITransformableFilterValues,的标准过滤器连接到任何可以使用IWebPartParameters的TransformableFilterValuesToParametersTransformer:部件”。
var transformer = new TransformableFilterValuesToParametersTransformer();
transformer.ProviderFieldNames = new string[] { "DocumentIdForCurrentPage" };
transformer.ConsumerFieldNames = new string[] { "DocumentId" };webPartManager.SPConnectWebParts( providerWebPart,providerConnection,consumerWebPart,consumerConnection,transformer);
https://stackoverflow.com/questions/997711
复制相似问题