What is the difference between the attributes WebBrowsable
and Personalizable
in a Sharepoint 2010 web part?
e.g.
[Personalizable(), WebBrowsable]
public string IconURL { get; set; }
vs
[WebBrowsable]
public string IconURL { get; set; }
MSDN gives the impression that personalizable
is per user, whereas webbrowseable
is for all users - however it doesn't explicitly mention this and I would like to get this sorted in my head.
E.g. can I set a user specific property on personalizable
and web-part wide on webbrowsable
?
The WebBrowseable attribute specifies that the decorated property should appear in the editor component of the web part. It only allows the end user to modify the property and does nothing about persistence.
The Personalizable attribute specifies that the value of the decorated property must be persisted in the SharePoint backend, either in the user store (by default) or in the shared store (if the Shared
scope is specified). It only cares about persistence and does nothing about the property presence in the editor component.
So, if you decorate a property with [WebBrowsable]
and not [Personalizable]
, the end user will be able to modify it in the editor component but its new value won't be persisted.
Conversely, if you decorate a property with [Personalizable]
and not [WebBrowsable]
, its value will be persisted but the end user won't be allowed to modify it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With