19Jan/102
SharePoint Web Part Custom Properties
In my current project, I am creating a SharePoint web part that simply renders a custom .NET User Control from a certain location. I want the user to be able to configure the User Control's properties through the Web Part properties. Therefore I followed the MSDN instruction on how to create a web part with custom properties. However, somehow the custom properties just doesn't show up.
So, after scratching my head for a couple of hours (not literally), I found something that, I think, was not accurately specified:
- Personalizable attribute needs to be specified
- Use WebBrowsable instead of Browsable attribute
This is the code-snippet that works for me:
[Category("Custom Properties")]
[DefaultValue(true)]
[Personalizable(PersonalizationScope.Shared)]
[WebPartStorage(Storage.Shared)]
[FriendlyNameAttribute("Include lists")]
[WebBrowsable(true)]
[XmlElement(ElementName = "IncludeLists")]
public bool IncludeLists { get; set; }