This topic has not yet been rated - Rate this topic

WebPartConnectionsEventArgs Class

Provides the event data for the WebPartsConnected and WebPartsDisconnected events of the WebPartManager control.

System.Object
  System.EventArgs
    System.Web.UI.WebControls.WebParts.WebPartConnectionsEventArgs

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)
public class WebPartConnectionsEventArgs : EventArgs

The WebPartConnectionsEventArgs type exposes the following members.

  Name Description
Public method WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint) Initializes a new instance of the WebPartConnectionsEventArgs class without requiring a WebPartConnection object.
Public method WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartConnection) Initializes a new instance of the class using the specified WebPartConnection object.
Top
  Name Description
Public property Connection Gets the WebPartConnection object of the current connection.
Public property Consumer Gets the WebPart control that is acting as the consumer in the connection.
Public property ConsumerConnectionPoint Gets the ConsumerConnectionPoint object of the current connection.
Public property Provider Gets the WebPart control that is acting as the provider in the connection.
Public property ProviderConnectionPoint Gets the ProviderConnectionPoint object of the current connection.
Top
  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top

Using the capabilities of the Web Parts control set, it is possible to create a connection between two WebPart or other server controls, with one control acting as the provider, and the other acting as the consumer of data. To form a connection, the two controls must reside in a zone that inherits from the WebPartZoneBase class (such as the WebPartZone control), and they must be designed correctly to share data through a common interface. For details about Web Parts connections, see WebPartConnection and Web Parts Connections Overview.

The WebPartConnectionsEventArgs class passes event data to methods that use the WebPartConnectionsEventHandler delegate to handle events. There are two such connection-related methods that raise events and use the WebPartConnectionsEventArgs class to provide event data. Both are members of the WebPartManager control. The OnWebPartsConnected method raises the WebPartsConnected event after two server controls have successfully connected, and the OnWebPartsDisconnected method raises the WebPartsDisconnected event after two server controls have been disconnected.

Developers can create custom event handler methods for the WebPartsConnected and WebPartsDisconnected events, and in those methods, they can use the WebPartConnectionsEventArgs class to access details of a connection. For example, a developer can declare the OnWebPartsConnected attribute on the <asp:webpartmanager> element, and assign to it a custom method name that will handle the event. In the custom handler method, developers can access the details of a connection by using the WebPartConnectionsEventArgs object that is passed to the method as a parameter.

The WebPartConnectionsEventArgs class has two overloads of the constructor. The WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint) constructor is the default; it initializes the property values for the class. The WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartConnection) constructor calls the default constructor, and then it also initializes the Connection property.

The WebPartConnectionsEventArgs class has several properties, all of which refer to the essential aspects of a Web Parts connection. The Connection property refers to the associated WebPartConnection object that represents the entire connection. The Provider property references a WebPart or other server control acting as the provider in the connection, and the Consumer property references a WebPart or server control acting as the consumer. The ProviderConnectionPoint property references the connection's ProviderConnectionPoint object, while the ConsumerConnectionPoint property references the ConsumerConnectionPoint object.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ