WebPartManager.OnDisplayModeChanging Method

Definition

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.

protected:
 virtual void OnDisplayModeChanging(System::Web::UI::WebControls::WebParts::WebPartDisplayModeCancelEventArgs ^ e);
protected virtual void OnDisplayModeChanging (System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs e);
abstract member OnDisplayModeChanging : System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs -> unit
override this.OnDisplayModeChanging : System.Web.UI.WebControls.WebParts.WebPartDisplayModeCancelEventArgs -> unit
Protected Overridable Sub OnDisplayModeChanging (e As WebPartDisplayModeCancelEventArgs)

Parameters

e
WebPartDisplayModeCancelEventArgs

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

Remarks

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

Notes to Inheritors

You can override the OnDisplayModeChanging(WebPartDisplayModeCancelEventArgs) 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.

Applies to

See also