0

When adding properties to a webpart, we add attributes such as:

[WebBrowsable(true),
WebDisplayName("Page Title"),
WebDescription("Title displayed on the page"),
Category("Test Properties"),
Personalizable(PersonalizationScope.Shared)]

However, if we need even more customization; we would have to over ride the ToolPart. In most examples online, I don't see any of the attributes as above when overriding the ToolPart.

  1. What is the permission scope when we override the toolpart this way?
  2. Am I still able to set the attribute above?

I want to keep most of the control private - for admin only and some I want to let the user set to personalized. I am just not sure I can still use the attribute above and it still works the same (ie.. PersonalizationScope.User).

0
  1. Can be both Shared or User. That only determines whether the value is saved globally, or per user. In your case that is User.
  2. Yes, you still can do that. It will still show up the usual way. If you want to only show it in the custom toolpart, set WebBrowsable to FALSE

So, in your case you could set WebBrowsable to FALSE for the Admin properties and do your admin checks in the custom toolpart.

See here for a walkthrough: http://www.learningsharepoint.com/2013/08/22/create-custom-webpart-properties-for-sharepoint-2013-visual-webpart/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.