This documentation is archived and is not being maintained.

WebPartManagerDesigner Class

Provides minimal design-time support for WebPartManager controls.

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

[SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)]
public ref class WebPartManagerDesigner : public ControlDesigner

The WebPartManagerDesigner class provides a bare-minimum design-time rendering of the WebPartManager control. It appears on the design surface as a plain gray box showing the name of the class and the ID of the current WebPartManager. You can change the rendering of a custom WebPartManager control by overriding the GetDesignTimeHtml method in the same manner as with any standard ControlDesigner. The UsePreviewControl property is overridden to always return true.

The following code example shows how to change the design-time appearance of a custom WebPartManager control by overriding the GetDesignTimeHtml method of the designer.

using System;
using System.Web;
using System.Security.Permissions;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Design.WebControls.WebParts;
using System.ComponentModel;

/// <summary> 
/// The PrettyPartManager class is an inherited copy of WebPartManager for 
/// the purpose of applying the PrettyPartManagerDesigner at design time. 
/// PrettyPartManager provides an arbitrary design time rendering of the 
/// control by overriding GetDesignTimeHtml() 
/// </summary> 
namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand,
      Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand,
      Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(PrettyPartManagerDesigner))]
    public class PrettyPartManager : WebPartManager {}

    public class PrettyPartManagerDesigner : WebPartManagerDesigner
    {
        public override string GetDesignTimeHtml()
        {
            string designTimeHtml = "";
            designTimeHtml = "<div style=\"background-color:bisque;";
            designTimeHtml += "border:thick groove mediumseagreen\">";
            designTimeHtml += "<span style=\"font:italic 16pt bold Garamond\">";
            designTimeHtml += "PrettyPartManager</span><br />";
            designTimeHtml += "<span style=\"font:italic 12pt Garamond\">";
            WebPartManager m = (WebPartManager)Component;
            designTimeHtml += m.ID;
            designTimeHtml += "</ span></ div>";
            return designTimeHtml;
        }
    }
}

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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: