Microsoft.SharePoint.WebPar ...


HtmlDesignerAttribute Class (Microsoft.SharePoint.WebPartPages)
Defines the HtmlDesigner attribute that is used on a Web Part custom property. It specifies if a custom property uses a custom builder and the URL of the builder, or if the custom property does not use any builder, including any default builder.

Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<AttributeUsageAttribute(AttributeTargets.Property)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class HtmlDesignerAttribute
    Inherits Attribute
Visual Basic (Usage)
Dim instance As HtmlDesignerAttribute
C#
[AttributeUsageAttribute(AttributeTargets.Property)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public sealed class HtmlDesignerAttribute : Attribute
Remarks

When a Web Part is opened in Microsoft Visual Studio 2005, the HtmlDesignerAttribute class is ignored. Only the default Visual Studio 2005 builders will be used.

Example

The following code example shows a Web Part with a custom property that uses HtmlDesignerAttribute to define a static custom builder.

C#
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System.Xml;

namespace WebPartLibrary2
{
    
    [XmlRootAttribute(Namespace="WebPartLibrary2")]

    
    public class HtmlDesignerAttributeTestPart: WebPart
    {
        ///    Member variable for a property with 
        ///    HtmlDesignerAttribute defined for a custom builder
        private string customPropertyValue = "This Web Part has a custom property";
        
        /// <summary>
        ///        Use HtmlDesignerAttribute to define a static custom 
        ///        builder builder.aspx for the custom property.
        /// </summary>
        [WebPartStorage(Storage = Storage.Personal), 
        DefaultValue(""), 
        HtmlDesignerAttribute("http://myserver/builder.aspx")]
        public string CustomProperty
        {
            get
            {
                return customPropertyValue;
            }
            set
            {    
                customPropertyValue = value;
            }
        }
        
        /// <summary>
        ///        Renders the content of the HtmlDesignerAttributeTestPart.
        /// </summary>
        protected override void RenderWebPart (HtmlTextWriter output)
        {
            output.Write(SPEncode.HtmlEncode(CustomProperty));
        }
    }

}
Inheritance Hierarchy

System.Object
   System.Attribute
    Microsoft.SharePoint.WebPartPages.HtmlDesignerAttribute
Thread Safety

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

Tags :


Page view tracker