Custom property of SharePoint web part doesn’t show up

SharePoint usually surprises me on the most busiest moments. I wrote web part that has some custom properties. These properties were simple ones and it was okay to show these properties in Miscellaneous section of web part property sheet. Although properties were defined nothing new showed up in property sheet.

Here is the example of property.


[WebPartStorage(Storage.Shared)]
[
FriendlyNameAttribute("Update interval"
)]
[
Description("Insert feed update interval"
)]
[
WebBrowsable(true)]
public int UpdateInterval { get; set; }

As it turns out there was one attribute missing.


[WebPartStorage(Storage.Shared)]
[
Personalizable(PersonalizationScope
.Shared)]
[
FriendlyNameAttribute("Update interval"
)]
[
Description("Insert feed update interval"
)]
[
WebBrowsable(true)]
public int UpdateInterval { get; set; }

Look at the second line that sets Personalizable attribute. If this line is missing then SharePoint doesn’t show custom property in web part property sheet.


Leave a Reply

Your email address will not be published. Required fields are marked *