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.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    One thought on “Custom property of SharePoint web part doesn’t show up

    • February 15, 2010 at 1:31 pm
      Permalink

      Thank you!

      The only code that helped me. Many other codes didn’t do.

    Leave a Reply

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