SPWebPartManager.SPConnectWebParts Method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer)
Creates a SPWebPartConnection between two Web Parts with the references to the specified Web Parts, the specified ConnectionPoint objects and a specified WebPartTransformer.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Function SPConnectWebParts ( _
provider As WebPart, _
providerConnectionPoint As ProviderConnectionPoint, _
consumer As WebPart, _
consumerConnectionPoint As ConsumerConnectionPoint, _
transformer As WebPartTransformer _
) As SPWebPartConnection
'Usage
Dim instance As SPWebPartManager
Dim provider As WebPart
Dim providerConnectionPoint As ProviderConnectionPoint
Dim consumer As WebPart
Dim consumerConnectionPoint As ConsumerConnectionPoint
Dim transformer As WebPartTransformer
Dim returnValue As SPWebPartConnection
returnValue = instance.SPConnectWebParts(provider, _
providerConnectionPoint, consumer, _
consumerConnectionPoint, transformer)
public SPWebPartConnection SPConnectWebParts(
WebPart provider,
ProviderConnectionPoint providerConnectionPoint,
WebPart consumer,
ConsumerConnectionPoint consumerConnectionPoint,
WebPartTransformer transformer
)
Parameters
provider
Type: System.Web.UI.WebControls.WebParts.WebPartThe Web Part that provides data to consumer when the controls are connected.
providerConnectionPoint
Type: System.Web.UI.WebControls.WebParts.ProviderConnectionPointThe connection point that acts as a callback method so that provider can participate in a connection.
consumer
Type: System.Web.UI.WebControls.WebParts.WebPartThe Web Part that receives data from provider when the controls are connected.
consumerConnectionPoint
Type: System.Web.UI.WebControls.WebParts.ConsumerConnectionPointThe connection point that acts as a callback method so that consumer can participate in a connection.
transformer
Type: System.Web.UI.WebControls.WebParts.WebPartTransformerA WebPartTransformer that enables an incompatible provider and consumer to connect. a null reference (Nothing in Visual Basic) can be passed if providerConnectionPoint and consumerConnectionPoint have the same interface type.
Return Value
Type: Microsoft.SharePoint.WebPartPages.SPWebPartConnection
A SPWebPartConnection that contains the information about the provider, consumer, and transformer needed for a connection.
Exceptions
Exception | Condition |
---|---|
WebPartPageUserException |
|
InvalidOperationException | The provider or consumer Web Part is not in a zone |
Remarks
This overload is used to connect Web Parts when their connection points are incompatible. The incompatibility occurs when the consumer and provider implement different interfaces.