This documentation is archived and is not being maintained.

EditorPartCollection::Contains Method

Returns a value that indicates whether a particular control is in the collection.

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

public:
bool Contains(
	EditorPart^ editorPart
)

Parameters

editorPart
Type: System.Web.UI.WebControls.WebParts::EditorPart

The EditorPart being tested for its status as a member of the collection.

Return Value

Type: System::Boolean
A Boolean value that indicates whether the EditorPart is in the collection.

The Contains method determines whether a specific EditorPart control is already in the EditorPartCollection object.

The following code example demonstrates how to determine whether a particular EditorPart control is in an EditorPartCollection object. For the full code required to run the example, see the Example section of the EditorPartCollection class overview.

The code in the Button1_Click event does not add the LayoutEditorPart1 control to the EditorPartCollection object when it adds the other controls. To confirm that the LayoutEditorPart1 control is not in the collection, the code uses the Contains method.

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

When you load the page in a browser, you can switch the page into edit mode by selecting Edit in the Display Mode drop-down list control. You can click the verbs menu (the downward arrow) in the title bar of the TextDisplayWebPart control, and click Edit to edit the control. When the editing user interface (UI) is visible, you can see the all the EditorPart controls. If you click the Create EditorPartCollection button, you will notice that the background color of the LayoutEditorPart1 control is different from the other controls, because it is not part of the EditorPartCollection object.

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: