WebPartManagerDesigner Class
Provides minimal design-time support for WebPartManager controls.
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 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.