Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebPartDisplayModeCollection::Add Method (WebPartDisplayMode^)

 

Adds a WebPartDisplayMode object to the collection.

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

public:
int Add(
	WebPartDisplayMode^ value
)

Parameters

value
Type: System.Web.UI.WebControls.WebParts::WebPartDisplayMode^

A WebPartDisplayMode to add to the collection.

Return Value

Type: System::Int32

An integer value that indicates where the WebPartDisplayMode was inserted into the collection.

You can use the Add method to add new WebPartDisplayMode objects to an existing WebPartDisplayModeCollection object.

An example of a scenario in which you would do this is when you create a custom WebPartDisplayMode class, and you want to add it to the collection of supported display modes on a page. To do that, you must inherit from the WebPartManager class and override its CreateDisplayModes method, first calling the base method, and then using the Add method to add the custom display mode to the collection.

This code example demonstrates the use of the WebPartDisplayModeCollection class. For the full code and instructions required to run the example, see the Example section of the WebPartDisplayModeCollection class overview.

The following section of code occurs in a derived WebPartManager class that overrides the CreateDisplayModes method and adds a custom display mode to the collection.

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft