CatalogPartCollection Constructor (ICollection)
Initializes a new instance of the CatalogPartCollection class by passing in an ICollection collection of CatalogPart controls.
Assembly: System.Web (in System.Web.dll)
Parameters
- catalogParts
- Type: System.Collections::ICollection
An ICollection of CatalogPart controls.
The CatalogPartCollection constructor initializes an instance of the CatalogPartCollection class and passes in a collection of CatalogPart controls. This is one overload of the CatalogPartCollection constructor that you can use to create a new CatalogPartCollection object and add CatalogPart controls to it.
Although the CatalogPartCollection instance created by the constructor is read-only, you can still access the individual CatalogPart controls in the collection programmatically and call their properties and methods.
One common scenario for using this constructor would be if you want to perform some batch operation on an entire set of CatalogPart controls, such as changing the content, appearance, or position of a related group of items.
The following code example demonstrates how you can create a custom CatalogPartCollection, and perform a batch operation to change the individual CatalogPart controls in the collection even though it is read-only. For the full code required to run the example, see the Example section of the CatalogPartCollection class overview topic.
The code in the Button1_Click method creates an ArrayList object, adds the two CatalogPart controls in the page to the object, and then creates a new CatalogPartCollection object using the CatalogPartCollection constructor. It also demonstrates how you can make batch changes to the underlying CatalogPart controls, even though the collection itself is read-only. The code loops through the collection, updating the Description property of each control.
When you load the page in a browser, you can switch the page into catalog mode by selecting Catalog in the Display Mode drop-down list control. Clicking the Display CatalogPart Properties button accesses the CatalogPartCollection object and displays certain properties of the contained CatalogPart controls. Also, if you position your mouse pointer over the title text within the border of the DeclarativeCatalogPart control, you can see the new description text that was added to the control when you clicked the button (the description appears in a ToolTip). If you click the Page Catalog link to display the PageCatalogPart control, you will find that it also has an updated description.
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.