SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a Sharepoint site which uses Custom-membership and custom-roles provider. I have hardcoded roles like “developer”,”software-engineer” and assigned these roles to some users.

I have a few custom web-parts in my site and I want to show/hide them based on the user role. For example, if the role is “Developer”, then hide the first web-part. I tried these approaches:

  • I edited the web-part in SP and went to target audience. I tried to add “Developer” in target audience, but the people picker does not pick my custom role. So this approach failed

  • I added a new share-point group called “DevelopersGroup”. In this group I added the role “Developer”. I then added this new group “DevelopersGroup” in the target audience of the web-part. But after this the web-part is not visible to anyone. Even the users whose role is developer cannot see it.

  • I think I can do this programmatically by using the webpart.hidden property, but I do not want to do this.

Can you please point to what I might be doing wrong. I would greatly appreciate any response. Thanks.

share|improve this question
Audience targetting should work, assuming you've created the audience in central administration. – Eric Alexander Jul 13 '12 at 19:56
Thanks for your reply. Do I have to create an audience in the central administration to make the "Target audience" work in my custom web part? Can anyone please help me on this – Ashu Jul 17 '12 at 13:40
I have exactly the same behavior. Did you fix it? Thank you – Jose Andreu Dec 3 '14 at 8:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.