Export (0) Print
Expand All

WebPartManager.CanConnectWebParts Method

Checks the WebPart controls that will be participating in a connection to determine whether they are capable of being connected.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method CanConnectWebParts(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint) Checks the WebPart controls that will be participating in a connection to determine whether they are capable of being connected, when the consumer and provider controls have compatible interfaces and a WebPartTransformer object is not needed.
Public method CanConnectWebParts(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartTransformer) Checks the WebPart controls that will be participating in a connection to determine whether they are capable of being connected, and uses a WebPartTransformer object to create the connection between an incompatible consumer and provider.
Top

The CanConnectWebParts method is used to determine whether two WebPart controls can be connected. The method is typically used as a conditional check prior to calling the ConnectWebParts method.

The CanConnectWebParts method checks a number of criteria that must be met before two controls can form a connection. The following list summarizes the primary criteria for making a connection. If all these criteria (plus some additional internal conditions) are met, the method returns true, meaning that the controls can be connected:

  • The provider and consumer controls cannot be null, and they must be contained in the collection of controls referenced by the WebParts property.

  • The provider and consumer cannot be the same control. In other words a WebPart control cannot connect to itself.

  • The ConnectionPoint objects (connection points) for both the provider and consumer cannot be null.

  • The provider and consumer cannot be closed (neither control's IsClosed property can be true).

  • The ControlType property of the connection point control must match the type of the control of both consumer and provider.

  • The connection points must both be enabled (their GetEnabled methods must both return true).

  • Each connection point must not be attempting to form more connections than what is specified in its own AllowsMultipleConnections property.

  • If a WebPartTransformer object (transformer) is required to connect incompatible controls, it cannot be null. However, if the controls are already compatible, the transformer must be null.

  • The transformer (if used) must be referenced in the AvailableTransformers collection.

  • The transformer (if used) must have interfaces that are compatible with the provider and the consumer so that it can transform data between the two controls. The secondary interfaces of the consumer and provider must also be compatible.

Community Additions

ADD
Show:
© 2014 Microsoft