Sharepoint multiple connections to a web parts
Is it possib开发者_Go百科le to create connected web parts in Sharepoint that have multiple connections to the provider.
For example, Web Part A and B are the provider, and Web Part C is the consumer.
A is the provider to consumer C, and B is also the provider to consumer C.
Thanks.
Rhys, I tried this and doesn't seem to work. The consumer web part only works with whatever the last provider it sets to.
[ConnectionConsumer("KeywordsConsumer", "KeywordsID", AllowsMultipleConnections=true)]
public void ProviderReceiver1(ICommunicationChannel p)
{
provider = p;
}
[ConnectionConsumer("NewEmployeeConsumer", "ID", AllowsMultipleConnections=true)]
public void ProviderReceiver2(ICommunicationChannel p)
{
provider = p;
}
I believe the problem is that your using the same variable (provider) to store both references - thus one will replace the other.
Use
private ICommunicationChannel _keywordsProvider;
private ICommunicationChannel _newEmployeeProvider;
[ConnectionConsumer("KeywordsConsumer", "KeywordsID", AllowsMultipleConnections=true)]
public void ProviderReceiver1(ICommunicationChannel p)
{
_keywordsProvider = p;
}
[ConnectionConsumer("NewEmployeeConsumer", "ID", AllowsMultipleConnections=true)]
public void ProviderReceiver2(ICommunicationChannel p)
{
_newEmployeeProvider = p;
}
Yes, in the web part C allows for multiple receivers.
If you are writing the web parts yourself you can define two receivers for web part C and then configure web part A to send data to receiver 1 and similarly web part B to send data for receiver 2.
精彩评论