SPWebPartManager.ConnectWebParts Method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer)
Creates a connection between two Web Parts.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Overrides Function ConnectWebParts ( _
provider As WebPart, _
providerConnectionPoint As ProviderConnectionPoint, _
consumer As WebPart, _
consumerConnectionPoint As ConsumerConnectionPoint, _
transformer As WebPartTransformer _
) As WebPartConnection
'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 WebPartConnection
returnValue = instance.ConnectWebParts(provider, _
providerConnectionPoint, consumer, _
consumerConnectionPoint, transformer)
public override WebPartConnection ConnectWebParts(
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: System.Web.UI.WebControls.WebParts.WebPartConnection
A SPWebPartConnection that contains the information about the provider, consumer, and transformer needed for a connection.
Exceptions
Exception | Condition |
---|---|
WebPartPageUserException | Either the providerConnectionPoint or consumerConnectionPoint is a Windows SharePoint Services 2.0 connection interface, if either the provider or consumer Web Part is not in a zone, or if ConnectWebParts(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer) is false |
Remarks
This override is called to connect two Web Parts after a conditional check to determine whether the Web Parts can be directly connected.