Bewerken

Delen via


WebPartConnection Constructor

Definition

Initializes a new instance of the WebPartConnection class.

public:
 WebPartConnection();
public WebPartConnection ();
Public Sub New ()

Remarks

The WebPartConnection constructor is public so that the ASP.NET parser can create an instance when a connection is declared in the markup of a Web page; this constructor is not intended to be used in developer code.

When you want to create a WebPartConnection object programmatically, you should use the WebPartManager.ConnectWebParts or the WebPartManager.ConnectWebParts method provided in the WebPartManager control. These methods handle the many details of creating a connection, and return a WebPartConnection object.

The WebPartConnection constructor for the WebPartConnection class sets the values of the IsShared and IsStatic properties to true. Thus the default state of a new connection is to be static (meaning that it is declared in the markup of the containing Web page) and shared (visible to all users of the page). This will be the case when you add a connection in the typical scenario, by declaring the connection in the markup of the page with an <asp:webpartconnection> element. However, in other circumstances a connection will have different values for these properties. For example, when you add a connection programmatically by creating the connection object in code, and the user is viewing the page in the default user personalization scope, the connection is created as a dynamic, per-user(visible only to the specific user) connection.

Note

The IsShared and IsStatic properties are read-only, and these properties that determine the nature of a connection are set internally by the WebPartManager control depending on how a connection is created (declaratively in the page markup, or programmatically through your code or the user interface).

Applies to

See also