WebPartConnection.ProviderConnectionPoint Property

Note: This property is new in the .NET Framework version 2.0.

Gets the object that serves as a connection point for a WebPart control acting as a provider for a connection.

Namespace: System.Web.UI.WebControls.WebParts
Assembly: System.Web (in system.web.dll)

public:
property ProviderConnectionPoint^ ProviderConnectionPoint {
	ProviderConnectionPoint^ get ();
}
/** @property */
public ProviderConnectionPoint get_ProviderConnectionPoint ()

public function get ProviderConnectionPoint () : ProviderConnectionPoint

Property Value

A ProviderConnectionPoint associated with the provider control in a connection.

One of the required steps for creating a connection between two WebPart controls is to create connection points for each control. The provider connection point is an object that contains the information about how to connect to the control acting as a provider. In the provider's source code, one of the methods must be identified with the ConnectionProvider attribute. The ProviderConnectionPoint that is associated with a provider control contains details about the method and the attribute, including an ID for the method, a display name for use in the user interface (UI), and what type of interface instance the method can return to a consumer control. This set of information about the provider, its method for forming connections, and the type of interface it provides, collectively forms a provider connection point.

By default, a ConsumerConnectionPoint can connect to only one ProviderConnectionPoint object at a time. A consumer could have multiple methods identified as possible consumer connection points, but a consumer can only participate in one connection as a consumer (hence, only one of its consumer connection points can be active) at a time. In contrast, a ProviderConnectionPoint can connect to any number of ConsumerConnectionPoint objects by default. For example, a provider control that provides a postal code could be connected to multiple consumer controls that use a postal code to create various kinds of data based on a postal code, such as weather data, news, and so on. This default behavior can be changed by overriding the AllowsMultipleConnections property on the ConnectionProviderAttribute attribute.

The following code example demonstrates the programmatic use of the ProviderConnectionPoint property.

The example has four parts:

  • A user control that enables you to change the Web Parts display mode on a page.

  • Source code for an interface and two WebPart controls acting as the provider and the consumer for a connection.

  • A Web page to host all the controls and run the code example.

  • An explanation of how to run the example page.

The first part of this code example is the user control that enables users to change display modes on a Web page. Save the following source code to an .ascx file, giving it the file name that is assigned to the Src attribute of the Register directive for this user control, which is near the top of the hosting Web page. For details about display modes and a description of the source code in this control, see Walkthrough: Changing Display Modes on a Web Parts Page.

No code example is currently available or this language may not be supported.

The second part of the code example is the source code for the two WebPart controls that serve as the consumer and the provider for the connection, and an interface used for the connection points. For the code example to run, you must compile this source code. You can compile it explicitly and put the resulting assembly in your Web site's Bin folder or the global assembly cache. Alternatively, you can put the source code in your site's App_Code folder, where it will be dynamically compiled at run time. This code example uses dynamic compilation. For a walkthrough that demonstrates how to compile, see Walkthrough: Developing and Using a Custom Server Control.

No code example is currently available or this language may not be supported.

The third part of the code example is the code for the Web page that hosts the controls and demonstrates the use of the ProviderConnectionPoint property. In the Button1_Click method, all the objects required to form a connection are created, including a ProviderConnectionPoint object. Note the call to the GetProviderConnectionPoints method on the WebPartManager control. The various created objects are all passed to the ConnectWebParts method to create the connection. In the Button2_Click method, the code accesses the ProviderConnectionPoint property and displays some details of the connection point.

No code example is currently available or this language may not be supported.

After you load the page in a browser, use the Display Mode drop-down list control to switch the page to connect mode. Click the verbs menu (represented by the downward arrow in the title bar) on one of the WebPart controls, and click the connect verb. Use the Connect WebPart Controls button, or the provided connection UI, to create a connection between the two controls. Click the ConnectionPoint Details button to run the code that demonstrates the ProviderConnectionPoint property.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: