views:

141

answers:

3

How can i make a browsable web part property which should be visible only to the Administrator and not to the normal users ?

+1  A: 

Go to the modify Shared webpart and uncheck the property Allow Editing in Personal View which comes under advanced.

Hojo
+1  A: 

I was thinking you could do this by creating your own version of WebBrowsableAttribute, (eg AdminOnlyWebBrowsableAttribute) and decorating your property with the custom version.

However, unfortunately the WebBrowsableAttribute class is sealed.

The best alternative I can think of is to create your own EditorPart so that you can control which properties are available to each user,

Paul Lucas
A: 

What attributes are you adding to the property being displayed in the editor? If you are only using [WebBrowsable(true)], the property will be personalizable for all users.

If you only want the property to be set by the admin in the shared scope, you should include a [WebPartStorage(Storage.Shared)] attribute.

See MSDN for more detail.

OedipusPrime