EditorPartCollection::Contains Method (EditorPart^)
Returns a value that indicates whether a particular control is in the collection.
Assembly: System.Web (in System.Web.dll)
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::BooleanA 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.
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.
Available since 2.0