Search code examples
c#sharepoint-2010web-partskey-valuecustom-properties

Key/Value custom webPart property - Sharepoint 2010


Couldn't find any related resources
I want to add a custom property to my visual webPart, the normal way of adding properties not working with type of Dictionary

[Personalizable(), WebBrowsable(), WebDisplayName("News Sources"), WebDescription("description")]
public Dictionary<Guid,string> NewsSources { get; set; }

any alternatives?


Solution

  • The property of type Dictionary cannot be added to Custom WebPart.

    If you want to have the dropdown list as the property, the backing store must be of type enum

    See:

    Creating a Web Part with Custom Properties
    http://msdn.microsoft.com/en-us/library/dd584174(v=office.11).aspx