This documentation is archived and is not being maintained.

WebPartManager::BrowseDisplayMode Field

Represents the default display mode for pages that contain Web Parts controls. This field is read-only.

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

public:
static initonly WebPartDisplayMode^ BrowseDisplayMode

The BrowseDisplayMode field references a custom WebPartDisplayMode object that is created and contained by the WebPartManager control. Because this is a static object, you can refer to it directly through the WebPartManager class without needing an instance of the control.

When a page that contains Web Parts controls first loads, it is in BrowseDisplayMode (browse mode) by default. When users are simply browsing as they would on a normal Web page, the page remains in browse mode. If users want to personalize a page's layout, controls, appearance, or behavior, they must switch the page into one of the specialized display modes available through the SupportedDisplayModes property.

The following code example demonstrates how to work with the BrowseDisplayMode field programmatically. The code populates a drop-down list with the supported display modes, which in this case are browse and design. Notice that, in the Page_PreRender method, the code checks whether the current DisplayMode property is set to BrowseDisplayMode. If so, Label1 will be visible, and if not, Label1 will be hidden.

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

After you load the page in a browser, you are in browse mode by default. Notice the label on the page that indicates you are in browse mode. Use the drop-down list control to switch the page to design mode. Notice that, because of the code in the Page_PreRender method, the label is now hidden.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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