Export (0) Print
Expand All

CatalogZoneBase.CatalogParts Property

Gets a collection of all the CatalogPart controls contained in a CatalogZoneBase zone.

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

public CatalogPartCollection CatalogParts { get; }

Property Value

Type: System.Web.UI.WebControls.WebParts.CatalogPartCollection
A CatalogPartCollection that contains all the individual CatalogPart controls in a zone.


A CatalogPart being added to the collection did not have a value assigned to its ID property.

The CatalogParts property provides a reference to a collection of all the CatalogPart controls in the zone. It references both the CatalogPart controls provided with the Web Parts control set, and any custom CatalogPart controls that are added to the zone.

The collection is initially created when another method accesses the CatalogParts property, and the property calls the CreateCatalogParts method.


Note that any CatalogPart that is added to the collection of CatalogPart controls in an implementation of the CreateCatalogParts method must have a value assigned to its ID property, otherwise an exception will be thrown when the collection is assigned to the CatalogParts property.

The following code example demonstrates how to access the CatalogParts property programmatically. For the full code required to run the example, see the Example section of the CatalogZoneBase class overview.

The code example shows how to access the CatalogParts property, iterate through the collection, and list the IDs of all the CatalogPart controls in the zone.

protected void Button2_Click(object sender, EventArgs e)
  Label1.Text = "<h3>CatalogPart List</h3>";
  foreach(CatalogPart part in CatalogZone1.CatalogParts)
    Label1.Text += part.ID + "<br />";

When you load the page in a browser, you can select Catalog from the drop-down list to switch to catalog display mode. When the catalog is visible, you can click the List CatalogParts button to demonstrate how the CatalogParts property can be accessed.

.NET Framework

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

Windows 8.1, Windows Server 2012 R2, 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.

© 2014 Microsoft