There seems to be a lot of confusion regarding how to expose custom properties on a web part. Even the information on MSDN is misleading. MSFT recommends to use the System.Web.UI.WebControls.Webparts.WebPart class instead of the SharePoint.WebPartPages.WebPart class, but then in all of the documentation on exposing properties on their site is listed using this.
(So if you are using the VSeWSS / CTP 1.1) you can use this method to expose the custom properties. The answer comes from the class itself, going to the .Net 2.0/ 3.0 documentation and finding answers! If you create a simple web part from a VS template, simply include this reference:
using System.ComponentModel;
to expose the Personalizable properties... and we are off!
Do not change anything you currently have in place on your working webpart, just add the following directives
[Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
Category("Miscellaneous"),
DefaultValue("http://"),
WebDisplayName("Site URL"),
WebDescription("This is the URL to the site containing the issues list.")]
public string siteURL
{
get { return _siteURL; }
set { _siteURL = value; }
}
if you want more options, just see MSDN for Personalizable under the .Net 2.0 area.
For what is listed:
Category is the string for the category on the toolbar that you want this property to go under.
DefaultValue sets the defualt, I also usually test for this in my web parts and see if it is set to some defualt string (in this case) and stop processing if it is.
WebDisplayName is the name listed just above the property.
WebDescription is the caption for the property.
Enjoy, and I hope this saves you some searching and time.
-DK