SPWebPartManager.SPConnectWebParts Method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint)
Creates a SPWebPartConnection between two Web Parts with the references to the specified Web Parts and the specified ConnectionPoint objects.
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 _
) As SPWebPartConnection
'Usage
Dim instance As SPWebPartManager
Dim provider As WebPart
Dim providerConnectionPoint As ProviderConnectionPoint
Dim consumer As WebPart
Dim consumerConnectionPoint As ConsumerConnectionPoint
Dim returnValue As SPWebPartConnection
returnValue = instance.SPConnectWebParts(provider, _
providerConnectionPoint, consumer, _
consumerConnectionPoint)
public SPWebPartConnection SPConnectWebParts(
WebPart provider,
ProviderConnectionPoint providerConnectionPoint,
WebPart consumer,
ConsumerConnectionPoint consumerConnectionPoint
)
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.
Return Value
Type: Microsoft.SharePoint.WebPartPages.SPWebPartConnection
The connection between the two Web Parts.
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 sufficiently compatible that they can connect without using a WebPartTransformer object.