WebPartConnectionsEventArgs 类


WebPartsConnected 控件的 WebPartsDisconnectedWebPartManager 事件提供事件数据。Provides the event data for the WebPartsConnected and WebPartsDisconnected events of the WebPartManager control.

public ref class WebPartConnectionsEventArgs : EventArgs
public class WebPartConnectionsEventArgs : EventArgs
type WebPartConnectionsEventArgs = class
    inherit EventArgs
Public Class WebPartConnectionsEventArgs
Inherits EventArgs


使用 Web 部件控件集的功能, 可以在两个WebPart或其他服务器控件之间创建连接, 其中一个控件充当提供程序, 另一个用作数据的使用者。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. 若要形成连接, 这两个控件必须位于继承自WebPartZoneBase类的区域 (例如WebPartZone控件) 中, 并且必须正确设计才能通过公共接口共享数据。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. 有关 Web 部件连接的详细信息, WebPartConnection请参阅和Web 部件连接概述For details about Web Parts connections, see WebPartConnection and Web Parts Connections Overview.

类将事件数据传递给WebPartConnectionsEventHandler使用委托来处理事件的方法。 WebPartConnectionsEventArgsThe WebPartConnectionsEventArgs class passes event data to methods that use the WebPartConnectionsEventHandler delegate to handle events. 有两种与连接相关的方法可引发事件并使用WebPartConnectionsEventArgs类提供事件数据。There are two such connection-related methods that raise events and use the WebPartConnectionsEventArgs class to provide event data. 两者都是WebPartManager控件的成员。Both are members of the WebPartManager control. 方法在两个WebPartsConnected服务器控件OnWebPartsDisconnected成功连接后引发事件, 方法在两个服务器控件WebPartsDisconnected断开连接后引发事件。 OnWebPartsConnectedThe 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.

开发人员可以为WebPartsConnectedWebPartsDisconnected事件创建自定义事件处理程序方法, 并在这些方法中使用WebPartConnectionsEventArgs类来访问连接的详细信息。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. 例如, 开发人员可以OnWebPartsConnected <asp:webpartmanager>在元素上声明特性, 并为其分配一个将处理事件的自定义方法名称。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. 在自定义处理程序方法中, 开发人员可以通过使用WebPartConnectionsEventArgs作为参数传递给方法的对象来访问连接的详细信息。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.

WebPartConnectionsEventArgs类具有两个构造函数重载。The WebPartConnectionsEventArgs class has two overloads of the constructor. WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint)构造函数是默认构造函数; 它初始化类的属性值。The WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint) constructor is the default; it initializes the property values for the class. 构造函数调用无参数的构造函数, 并Connection初始化属性。 WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartConnection)The WebPartConnectionsEventArgs.WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartConnection) constructor calls the parameterless constructor, and then it also initializes the Connection property.

WebPartConnectionsEventArgs类具有多个属性, 所有这些属性都是指 Web 部件连接的基本方面。The WebPartConnectionsEventArgs class has several properties, all of which refer to the essential aspects of a Web Parts connection. 属性引用表示整个连接的WebPartConnection关联对象。 ConnectionThe Connection property refers to the associated WebPartConnection object that represents the entire connection. 属性引用在连接中充当提供程序WebPartConsumer 或其他服务器控件,属性引用作为使用者的WebPartProvider服务器控件。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. 属性引用连接的ProviderConnectionPoint对象ConsumerConnectionPoint ,ConsumerConnectionPoint而属性引用对象。 ProviderConnectionPointThe ProviderConnectionPoint property references the connection's ProviderConnectionPoint object, while the ConsumerConnectionPoint property references the ConsumerConnectionPoint object.


WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint)

初始化 WebPartConnectionsEventArgs 类的新实例,而无需 WebPartConnection 对象。Initializes a new instance of the WebPartConnectionsEventArgs class without requiring a WebPartConnection object.

WebPartConnectionsEventArgs(WebPart, ProviderConnectionPoint, WebPart, ConsumerConnectionPoint, WebPartConnection)

使用指定的 WebPartConnection 对象初始化该类的新实例。Initializes a new instance of the class using the specified WebPartConnection object.



获取当前连接的 WebPartConnection 对象。Gets the WebPartConnection object of the current connection.


获取在连接中作为使用者的 WebPart 控件。Gets the WebPart control that is acting as the consumer in the connection.


获取当前连接的 ConsumerConnectionPoint 对象。Gets the ConsumerConnectionPoint object of the current connection.


获取在连接中作为提供者的 WebPart 控件。Gets the WebPart control that is acting as the provider in the connection.


获取当前连接的 ProviderConnectionPoint 对象。Gets the ProviderConnectionPoint object of the current connection.



确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)