0

I've 2 list view webparts on a page where I'm using query string URL to filter data. I wanted to display one of the webparts based on permission. Setting the target audience to a specific SP group will not work when users belong to both the groups. Is there any way I can hide one of the webparts?

Note: Users belonging to Gr A should see only webpart X and the users belonging to Gr B should see only webpart Y. All Gr A members are also members of Gr B but not vice-versa.

1

Here's a viable approach:

  1. Add web parts X and Y to your page as normal.

  2. Use audience targeting to make web part X visible only to Group A.

  3. Add a content editor web part that uses CSS or JavaScript to hide web part Y (setting its root element's style.display property to "none").

  4. Apply audience targeting to your content editor web part so that it only appears for Group A.

  5. Now members of Group A should only see Web Part X (because Web Part Y will be hidden by the content editor web part that only they can see).

The exact CSS or JavaScript that would need to add to your content editor web part depends on the HTML that is generated by your list view web part.

  • CSS in a CEWP targeted to Group A did the job for me. Many thanks. – Korak Jun 15 '16 at 16:13

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.