首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >BDC Web部件连接接口错误

BDC Web部件连接接口错误
EN

Stack Overflow用户
提问于 2009-06-15 18:52:40
回答 3查看 1.2K关注 0票数 2

我想从(提供者) businessdata filter webpart向BDC列表WebPart提供"Query Value“。当我尝试连接时,我得到了fllowing错误。提供程序连接点(BusinessDataFilterWebPart)和使用者连接点"BusinessDataListWebPart“未使用相同的连接接口。

以下是我的代码片段。

代码语言:javascript
复制
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);
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2009-06-16 12:46:53

看起来您正在比较两个不同的连接接口。提供者连接实现ITransformableFilterValues,使用者连接实现IWebPartParameters。

我不太了解您在这里编写的代码,因为我很少用代码编写web部件之间的连接。但是关于连接的全部要点是使用者和提供者必须提供并期望相同的接口。

您是否尝试过在浏览器界面中将这两个web部件连接在一起?

票数 0
EN

Stack Overflow用户

发布于 2010-02-13 00:05:19

我在这个问题上的直接经验是,查询字符串筛选器web部件作为提供者,报表查看器web部件作为使用者,但问题是相同的。

IWebPartParameters接口不能使用ITransformableFilterValues接口。但是connection points集合中的每个项都实现不同的接口类型。

在调试器中,检查ConsumerConnectionPointCollection和ProviderConnectionPointConnection实现的其他接口类型。如果两个集合具有实现相同接口类型的连接,请在检查接口类型的foreache中使用该接口类型。

如果没有直接匹配,您应该尝试找到正确的组合。

票数 0
EN

Stack Overflow用户

发布于 2012-05-10 04:13:34

您需要使用正确的转换器和覆盖方法,并将转换作为参数,以便两个接口可以连接/转换。msdn文档中提到的“允许实现Microsoft.SharePoint.WebPartPages.ITransformableFilterValues,的标准过滤器连接到任何可以使用IWebPartParameters的TransformableFilterValuesToParametersTransformer:部件”。

代码语言:javascript
复制
var transformer = new TransformableFilterValuesToParametersTransformer();
               transformer.ProviderFieldNames = new string[] { "DocumentIdForCurrentPage" };
               transformer.ConsumerFieldNames = new string[] { "DocumentId" };

webPartManager.SPConnectWebParts( providerWebPart,providerConnection,consumerWebPart,consumerConnection,transformer);

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/997711

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档