WebPartConnection.IsStatic Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value that indicates whether a WebPartConnection object is declared in the markup of a Web page, or created programmatically.

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

member IsStatic : bool with get

Property Value

Type: System.Boolean

true if the connection is static; otherwise, false.

Connections between Web Parts controls can be either static or dynamic. A static connection is declared in the markup of a Web page, using an <asp:WebPartConnection> element. Dynamic connections are created programmatically or when a user creates a connection through the user interface (UI) defined by the ConnectionsZone control.

Static connections are shared objects, meaning they are available to all users of the Web page. Also, they are essentially permanent because, like a static WebPart control, they cannot be permanently deleted.


While a static connection object cannot be permanently deleted, it can be permanently disconnected. In this case, the disconnected object would exist on the server, but an end user would never be aware of the object's existence in a page.

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

The code example has three parts:

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

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

  • An explanation of how to run the example page.

The first part of the code example is the source code for the interface, and the consumer and provider controls. 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 Web Server Control.

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

The second part of the code example is the Web page. Near the top is a Register directive that refers to the source code for the two dynamically compiled WebPart controls. The static connection is declared within the <StaticConnections> element on the page. The Button1_Click method accesses the IsStatic property to check whether the connection is static.

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

Load the page in a browser. The static connection is already created. Enter some text in the provider control, and note that the text is displayed in the consumer control. Click the Connection Details button to display the value of the IsStatic property.

.NET Framework
Available since 2.0
Return to top