共用方式為


ProxyWebPartManager Web Server Control Overview

The ProxyWebPartManager control enables you to declare static connections in a content page when a WebPartManager control has been declared in the content page's associated master page.

This topic contains:

  • Background

  • Code Examples

  • Class Reference

Background

A Web page that uses Web Parts controls must contain one (and only one) WebPartManager control that manages all Web Parts controls on the page. When a Web Parts application uses master pages, it is common to put the WebPartManager control in the master page. When content pages are merged with the master page at run time, the single WebPartManager control can manage Web Parts controls on all the content pages.

Declaring a static connection ordinarily requires that you add an asp:webpartconnection element as a child of a staticconnections element, which must be a child of an asp:webpartmanager element. However, when you use master pages and put the WebPartManager control in the master page, you cannot create a asp:webpartmanager element in a content page. This is because only one WebPartManager control is permitted. The solution is to use a ProxyWebPartManager control on the content page, which takes the place of the WebPartManager control.

At run time, the connections in the ProxyWebPartManager control are added to the StaticConnections collection of the WebPartManager control and are treated like any other connection.

For a code example that shows how to use the ProxyWebPartManager class, see the "Example" section of System.Web.UI.WebControls.WebParts.ProxyWebPartManager.

Differences Between the ProxyWebPartManager Control and the WebWebManager Control

The ProxyWebPartManager control is used only when you have created a WebPartManager control in a master page and you want to declare static connections in the content page. The ProxyWebPartManager control therefore has more limited functionality than the WebPartManager control. Although the ProxyWebPartManager control acts as a proxy to contain static connections for the WebPartManager control in content pages, it does not inherit from the WebPartManager control. Instead, it inherits directly from the Control class and overrides only some of the base members.

For more information about differences between the ProxyWebPartManager control and the WebPartManager control, see the ProxyWebPartManager documentation.

Back to top

Code Examples

Walkthrough: Creating a Web Parts Page

How to: Treat a User Control as a Web Parts Control

How to: Provide Optional Web Parts Controls

How to: Enable Users to Import Web Parts Control Settings

How to: Export Web Parts Control Settings

How to: Build and Run the Data-bound Web Parts Control Example

Walkthrough: Changing Display Modes on a Web Parts Page

How to: Set the Display Mode of a Web Parts Page

Walkthrough: Implementing Web Parts Personalization with a User Control

Walkthrough: Implementing Web Parts Personalization using IPersonalizable

How to: Enable Shared Personalization of Web Parts Pages

How to: Disable Web Parts Personalization

How to: Create Personalizable Properties on a Web Parts Control

How to: Remove User Entries from the Personalization Store

How to: Enable Users to Clear Personalization State

How to: Declare a Static Connection between Two Web Parts Controls

Back to top

Class Reference

Back to top

See Also

Concepts

WebPartManager Web Server Control Overview

Web Parts Personalization Overview

Reference

WebPartManager

Web Parts Control Set Overview

EditorPart

Other Resources

ASP.NET Web Parts Controls