This documentation is archived and is not being maintained.

PageCatalogPart Class

Provides a catalog that keeps references to all WebPart controls (and other server controls contained in WebPartZoneBase zones) that a user has closed on a single Web Parts page, which enables users to add the closed controls back to the page. This class cannot be inherited.

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

[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class PageCatalogPart sealed : public CatalogPart
<asp:PageCatalogPart />

The PageCatalogPart class serves one very specific purpose on a Web Parts page: it acts as a page catalog to maintain any controls previously added to the page that a user has closed, so that the user can add them back to the page. This control is visible only when a Web page is in catalog display mode, a special view that enables users to add and remove controls on the page. Add a PageCatalogPart control to your page if you want to provide users with the flexibility of closing and reopening controls. If your page does not allow users to close controls at all, there is no need to add a PageCatalogPart control to your page.

Only closed controls are added to the page catalog. A closed control has several attributes:

  • It is not visible on the page.

  • It is not rendered on the page.

  • It does not participate in page life-cycle phases.

Closing a control is different from deleting it, which permanently removes it from the page. A user can reopen a closed control instance from a page catalog, but after a user deletes a control, he or she can never recover that specific instance.

The most common and convenient way to add a PageCatalogPart control to a page is by declaring it in page persistence format. As with any declarative CatalogPart control, a PageCatalogPart control must be declared within the proper context of ASP.NET markup elements on a Web page. For a working code example of how to declare a PageCatalogPart control in a Web page, see the Example section of this topic. You must add the following sequence of declarative elements to the page:

  1. An <asp:catalogzone> element must be declared, and a child <zonetemplate> element must be added to it to contain any CatalogPart controls declared in the zone.

  2. An <asp:pagecatalogpart> element must be added as a child of the <zonetemplate> element. There might also be other CatalogPart controls declared as child elements of the <zonetemplate> element, including DeclarativeCatalogPart or ImportCatalogPart controls.

The PageCatalogPart class has only one usable property, the Title property, which overrides the base property so that a default title can be provided for the page catalog if no value is supplied.

The remaining properties for the PageCatalogPart class override the inherited properties, but are not actually used for rendering the control. They are overridden only so that special code attributes can be set on them to hide them from design tools like Microsoft Visual Studio 2005. You should not use these hidden properties, because they have no effect on rendering. The fact that they are hidden from IntelliSense and the Properties pane in Visual Studio helps developers avoid using them by mistake. All these hidden properties are noted as such in their respective Help topics.

The PageCatalogPart class also has several important methods. The GetAvailableWebPartDescriptions method retrieves a WebPartDescription object for each WebPart control in the page catalog, which enables a PageCatalogPart control to display information about each server control without having to create an instance of that control. Another method is the GetWebPart method. This method gets an instance of a particular WebPart control, based on the description passed to the method.

Accessibility

The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.

TopicLocation
How to: Set the Display Mode of a Web Parts PageBuilding ASP .NET Web Applications
How to: Set the Display Mode of a Web Parts PageBuilding ASP .NET Web Applications

The following code example demonstrates how to use the PageCatalogPart control declaratively on a Web page. This example has four parts:

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

  • A Web page that contains a CatalogZone control, a PageCatalogPart control, and a DeclarativeCatalogPart control.

  • A source code file that contains two custom WebPart controls.

  • An explanation of how the example works when you load the page in a browser.

The first part of this code example is the user control that enables users to change display modes on a 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 Web page. At the top of the page are two register directives, one for the user control and one for the compiled component that contains the two custom WebPart controls. Notice that the page has a declarative reference to the PageCatalogPart control, nested within the proper hierarchy of declarative elements as described in the Remarks section of this topic. There is also an <asp:declarativecatalogpart> element, which contains references for a standard ASP.NET Calendar control and the two custom WebPart controls, all of which are the controls that users can select from the catalog.

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

The third part of the code example is the source code for the two WebPart 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. For a walkthrough that demonstrates both methods of compiling, see Walkthrough: Developing and Using a Custom Web Server Control.

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

When you load the page in a browser, select Catalog Mode in the Display Mode drop-down list control to switch to catalog mode. In catalog mode, you can see the controls that are available to be added to the page. Add one of the controls, then use the Display Mode drop-down list control to return the page to browse mode. Click the verbs menu (the downward arrow) in the title bar of one of the controls, and click Close to close the control. Return the page to catalog mode, and notice that the control you closed now appears in the page catalog, and is available to be added back to the page.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: