CatalogPartCollection.IndexOf Method

Note: This method is new in the .NET Framework version 2.0.

Returns the position of a particular member of the collection.

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

public:
int IndexOf (
	CatalogPart^ catalogPart
)
public int IndexOf (
	CatalogPart catalogPart
)
public function IndexOf (
	catalogPart : CatalogPart
) : int

Parameters

catalogPart

A CatalogPart that is a member of the collection.

Return Value

A CatalogPart that is a member of the CatalogPartCollection.

The IndexOf method is useful if you have multiple CatalogPart controls on a Web Parts page, and you need to locate a particular control in the collection.

The following code example demonstrates how you can determine the position of a member of a CatalogPartCollection collection by using its IndexOf property. 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 a new CatalogPartCollection object named myParts. The method uses the IndexOf property to retrieve the position of the PageCatalogPart control, and then changes a property value on the control.

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

After 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. Click the Page Catalog link to display the contents of the PageCatalogPart control. Note that it has only a title and no border, because its ChromeType property value was changed to TitleOnly in the code that used the IndexOf property to retrieve the control.

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

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: