Compartilhar via


SPWebPartManager.CanConnectWebParts Method (WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer)

Checks the Web Parts that will be participating in a connection to determine whether they can be connected, and uses a WebPartTransformer object to create the connection between an incompatible consumer and provider.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Overrides Function CanConnectWebParts ( _
    provider As WebPart, _
    providerConnectionPoint As ProviderConnectionPoint, _
    consumer As WebPart, _
    consumerConnectionPoint As ConsumerConnectionPoint, _
    transformer As WebPartTransformer _
) As Boolean
'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 Boolean

returnValue = instance.CanConnectWebParts(provider, _
    providerConnectionPoint, consumer, _
    consumerConnectionPoint, transformer)
public override bool CanConnectWebParts(
    WebPart provider,
    ProviderConnectionPoint providerConnectionPoint,
    WebPart consumer,
    ConsumerConnectionPoint consumerConnectionPoint,
    WebPartTransformer transformer
)

Parameters

Return Value

Type: System.Boolean
true if the Web Parts can be connected; otherwise, false.

Remarks

This override will return false under any of the following conditions:

  1. The two Web Parts cannot be connected.

  2. The providerConnectionPoint or consumerConnectionPoint is a Windows SharePoint Services 2.0 connection interface.

  3. Either provider or consumer Web Parts are not in a zone.

  4. CanSPConnectWebParts(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer) returns false.

See Also

Reference

SPWebPartManager Class

SPWebPartManager Members

CanConnectWebParts Overload

Microsoft.SharePoint.WebPartPages Namespace