Export (0) Print
Expand All

WebPartCollection.Item Property (String)

Returns a member of the collection based on a unique string identifier.

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

public WebPart this[
	string id
] { get; }


Type: System.String

The unique identifier for a particular WebPart control in a collection.

Property Value

Type: System.Web.UI.WebControls.WebParts.WebPart
The first WebPart in the collection whose ID equals the value of id.

The Item indexer enables you to access a WebPart control in a WebPartCollection object according to a unique identifier.


The Web Parts control set performs case-insensitive matching on this property, so case sensitivity is not part of a unique id value.

The Item property also works to identify members of a WebPartCollection object in some specialized cases. In the case of GenericWebPart controls, the indexer is able to match the identifier for the underlying child control wrapped by the GenericWebPart control. In the case of ProxyWebPart controls, the indexer matches the identifier for the control based on a case-insensitive comparison of the id parameter and either the OriginalID or GenericWebPartID property values.

.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