共用方式為


Displaying Custom Property in Editor Web Part

If you've searched the web for articles on how to create custom web parts, then you will see some articles that describe how to do it in SharePoint 2003 and some will describe techniques in 2007.  Make sure you are reading the article for the right version because the code is similar except for a couple of attributes.  More specifically, if you want to show your custom properties in the Editor Web Part (in MOSS 2007), then make sure you decorate your properties with the Personalizalbe and WebBrowsable attributes. 

For example, the following property will be displayed in the Editor Web Part when you put your web part in edit mode:

[Personalizable, // required

WebBrowsable(true), // required

Category("Category to display property in"),

WebPartStorage(Storage.Personal),

FriendlyName("Capture in property pane"),

Description("Description displayed as tool tip")]

public DateTime Foo

{

get { return _foo; }

set { _foo = value; }

}

Comments