CatalogZone.CreateCatalogParts Method

Definition

Creates an instance of each CatalogPart type that is declared in the zone.

C#
protected override System.Web.UI.WebControls.WebParts.CatalogPartCollection CreateCatalogParts();

Returns

A CatalogPartCollection with references to all the CatalogPart controls in the zone.

Exceptions

The current CatalogPart control does not have an ID.

Remarks

The CreateCatalogParts method is a critical method because when a user switches a page to catalog display mode, this method creates all the CatalogPart controls that make up the Web Parts catalog.

The CreateCatalogParts method in the CatalogZone class provided with the Web Parts control set can create any server control that inherits from the CatalogPart class. So, if you create a custom CatalogPart control and declare it on a page within a CatalogZone control, this method will create your control when a user switches the page to catalog mode.

However, for various reasons you might want control over the CreateCatalogParts method. You might want it to create only certain CatalogPart controls. For example, suppose you create a set of custom CatalogPart controls that have a consistent appearance and belong to a single product or organization. If you want page developers to be limited to using those custom controls in a catalog, then you should inherit from the CatalogZone class, override the CreateCatalogParts method, and allow the method to create only controls of the same type as your custom controls.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also