WebPartManagerDesigner Class
Assembly: System.Design (in system.design.dll)
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; } } }
- SecurityPermission for calling unmanaged code. Demand value: Demand. Permission value: UnmanagedCode
System.ComponentModel.Design.ComponentDesigner
System.Web.UI.Design.HtmlControlDesigner
System.Web.UI.Design.ControlDesigner
System.Web.UI.Design.WebControls.WebParts.WebPartManagerDesigner
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.