This topic has not yet been rated - Rate this topic

ExitDesignModeControl Class

Represents a design mode exit control which is typically displayed in the Design Mode Console.

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.WebControls.ExitDesignModeControl

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class ExitDesignModeControl : WebControl
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
ExitDesignModeControl
Description

The Microsoft.SharePoint.WebControls.ExitDesignModeControl inherits from the System.Web.UI.WebControls.WebControl class. The ExitDesignModeControl is responsible for calling the appropriate JavaScript that will toggle the layout mode of a WebPart page out of Design Mode. The most apparent location where this control is employed is on a WebPart page while in Edit Mode. 

ExitDesignModeControl is a minimal web control that builds an HTML table with two rows. The first row contains a textual link and the second row contains an image link. Both of these links call the same JavaScript, MSO_Layout_ChangeLayoutMode, in order to toggle the layout mode. 

The Usage Scenario

The prime usage of ExitDesignModeControl is evident when heavily using personalization services and WebPart pages heavily reliant on end user editing. In such cases, it is imperative to keep users informed current page state. Internally, this control is employed when placing a WebPart page into Edit Mode.

Since ExitDesignModeControl is a standard web control we can use it within a custom WebPart similiar to any orthodox web control. In the below we are instantiating a new ExitDesignModeControl object, and then adding it to the current instance control collection.

C# Code Example

protected override void CreateChildControls()
{
ExitDesignModeControl designMode = new ExitDesignModeControl ();
designMode.ID = "Design Mode";
Controls.Add(designMode);
}

Visual Basic .NET Code Example

Protected Overloads Overrides Sub CreateChildControls()
Dim designMode As New ExitDesignModeControl()
designMode.ID = "Design Mode"
Controls.Add(designMode)
End Sub