This topic has not yet been rated - Rate this topic

WebPartConnection Constructor

Initializes a new instance of the WebPartConnection class.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)
public WebPartConnection()

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.

NoteNote

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).

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.