แก้ไข

แชร์ผ่าน


ConnectionConsumerAttribute Constructors

Definition

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a value to use for the connection point display name, and optionally specifying values to use for the connection point's ID, the connection point type, or both.

Overloads

ConnectionConsumerAttribute(String)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name for the consumer connection point.

ConnectionConsumerAttribute(String, String)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and an ID for the consumer connection point.

ConnectionConsumerAttribute(String, Type)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and a specific type of connection point object to use for the consumer connection point.

ConnectionConsumerAttribute(String, String, Type)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name, an ID, and a specific type of connection point object to use for the consumer connection point.

Remarks

A consumer control can have multiple methods marked with the ConnectionConsumerAttribute metadata element. In this case, the consumer would have multiple connection points, and each instance of the ConnectionConsumerAttribute element should specify a unique ID value for the associated connection point, so that the consumer's connection points can be distinguished.

ConnectionConsumerAttribute(String)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName);
public ConnectionConsumerAttribute (string displayName);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String)

Parameters

displayName
String

A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

Exceptions

displayName is null.

Examples

The following code example demonstrates using the ConnectionConsumerAttribute class, by showing how to declare the ConnectionConsumerAttribute metadata element on a callback method in a consumer control. Note that the simplest overload of the constructor is used; only the displayName parameter value is supplied. For the full code required to run the code example, see the ConnectionConsumerAttribute class overview.

[ConnectionConsumer("Row")]
public void SetConnectionInterface(IWebPartRow provider) 
{
    _provider = provider;
}
    <ConnectionConsumer("Row")> _
    Public Sub SetConnectionInterface(ByVal provider As IWebPartRow)
        _provider = provider

    End Sub
End Class

Remarks

This constructor creates an instance of the attribute that is used with a method of a Web Parts control acting as a consumer. This method becomes the connection point between the provider and the consumer. Typically, the way you use this constructor is to declare a ConnectionConsumerAttribute metadata element on a method that you want to designate as a callback method in a consumer control.

The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

See also

Applies to

ConnectionConsumerAttribute(String, String)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and an ID for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, System::String ^ id);
public ConnectionConsumerAttribute (string displayName, string id);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * string -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, id As String)

Parameters

displayName
String

A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

id
String

The ID, a unique string value assigned to the consumer connection point.

Exceptions

displayName or id is null.

Remarks

The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

The id parameter is used to specify the ID for the consumer connection point associated with the specific callback method. A control can have multiple connection points, but the id for each must be unique. Therefore, this overload of the constructor is useful if you have multiple callback methods in your consumer control.

See also

Applies to

ConnectionConsumerAttribute(String, Type)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name and a specific type of connection point object to use for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, Type ^ connectionPointType);
public ConnectionConsumerAttribute (string displayName, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * Type -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, connectionPointType As Type)

Parameters

displayName
String

A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

connectionPointType
Type

A Type that derives from ConsumerConnectionPoint, and that you want to specify as the type of connection point object to use with a specific callback method.

Exceptions

displayName or connectionPointType is null.

connectionPointType is not valid.

Remarks

The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

The connectionPointType parameter must be a Type derived from ConsumerConnectionPoint. If this parameter is specified, the Type is used to create the connection point instead of the standard ConsumerConnectionPoint class provided with the Web Parts control set.

See also

Applies to

ConnectionConsumerAttribute(String, String, Type)

Initializes a new instance of the ConnectionConsumerAttribute class, specifying a display name, an ID, and a specific type of connection point object to use for the consumer connection point.

public:
 ConnectionConsumerAttribute(System::String ^ displayName, System::String ^ id, Type ^ connectionPointType);
public ConnectionConsumerAttribute (string displayName, string id, Type connectionPointType);
new System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute : string * string * Type -> System.Web.UI.WebControls.WebParts.ConnectionConsumerAttribute
Public Sub New (displayName As String, id As String, connectionPointType As Type)

Parameters

displayName
String

A string that contains a friendly name for the consumer connection point to display in the user interface (UI).

id
String

The ID, a unique string value assigned to the consumer connection point.

connectionPointType
Type

A Type that derives from ConsumerConnectionPoint, and that you want to specify as the type of connection point object to use with a specific callback method.

Exceptions

displayName, id, or connectionPointType is null.

connectionPointType is not valid.

Remarks

The displayName parameter is a friendly name of the consumer connection point that is used by the ConnectionsZone control to represent a consumer's connection point in the UI.

The id parameter is used to specify the ID for the consumer connection point associated with the specific callback method. A control can have multiple connection points, but the id for each must be unique. Therefore, this overload of the constructor is useful if you have multiple callback methods in your consumer control.

The connectionPointType parameter must be a Type derived from ConsumerConnectionPoint. If this parameter is specified, the Type is used to create the connection point instead of the standard ConsumerConnectionPoint class provided with the Web Parts control set.

See also

Applies to