WebPartManager.OnDisplayModeChanging Method (WebPartDisplayModeCancelEventArgs)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Raises the DisplayModeChanging event to indicate that the WebPartManager control is in the process of switching from one display mode to another on a Web page.

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

protected virtual void OnDisplayModeChanging(
	WebPartDisplayModeCancelEventArgs e


Type: System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs

An EventArgs that contains event data associated with a changing display mode.

The OnDisplayModeChanging method in its base form simply raises the DisplayModeChanging event.

Notes to Inheritors:

You can override the OnDisplayModeChanging method. For example, as a display mode is changing, you might want to check what the new display mode will be (by using the NewDisplayMode property) and change something in the user interface (UI) based on what the new display mode will be. If you had a custom display mode, you might want to make certain controls visible if the custom mode is going to be the new display mode.

When you override this method, you should normally call the base method as the first step of the overridden method, so that the event is raised to indicate a display mode is starting to change. Then, your custom code can make changes in the user interface (UI) before the new display mode is actually displayed.

.NET Framework
Available since 2.0
Return to top