EditorPartDesigner Class

Provides design-time support for EditorPart controls.

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

public class EditorPartDesigner : PartDesigner
public class EditorPartDesigner extends PartDesigner
public class EditorPartDesigner extends PartDesigner
Not applicable.

EditorPartDesigner is a public implementation of the PartDesigner base class for the purpose of rendering EditorPart controls at design time. It adds the capability of carrying zone information from the associated control into design view, but does not otherwise change the functionality of the parent control.

As with other control designers, you can change the design-time rendering of custom EditorPart controls by inheriting from EditorPartDesigner and overriding the GetDesignTimeHtml method. If you want to override the CreateViewControl method, be sure to include the base implementation so as to retain zone information.

The following code example creates a simple custom EditorPart control that allows the user to change the ToolTip property of the target control. The associated EditorPartDesigner validates the control and replaces the user input text box at design time with a label explaining that it is hidden.

In order for the custom control to render, the page must have a WebPartManager control, an EditorZone with a ZoneTemplate for the control to reside in, and a WebPartZone containing a control for the custom EditorPart to act on, as shown in the following code example.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="ccl" Namespace="Samples.AspNet.CS.Controls" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>EditorPartDesigner Sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:WebPartManager ID="WebPartManager1" runat="server">
        </asp:WebPartManager><br />
        <asp:EditorZone ID="EditorZone1" runat="server" Enabled="true" >
            <ZoneTemplate>
                <ccl:SecretEditorPart ID="SEPart1" runat="server" />
            </ZoneTemplate>
        </asp:EditorZone>
        <asp:WebPartZone ID="WebPartZone1" runat="server">
            <ZoneTemplate>
                <asp:Button ID="Button1" runat="server" Height="24px" Text="Button" />
            </ZoneTemplate>
        </asp:WebPartZone><br />
    </div>
    </form>
</body>
</html>

For the EditorPart to be usable at run time, edit mode must be enabled on the page. The following code example demonstrates how to do so with a code-behind file.

using System;
using System.Web.UI.WebControls.WebParts;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        {
            // Make the 'Edit' verb available so the EditorZone can render
            WebPartManager mgr = WebPartManager.GetCurrentWebPartManager(Page);
            mgr.DisplayMode = mgr.SupportedDisplayModes["Edit"];
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Show: