Web part - Display to roles

Matthew Lee asked on January 30, 2015 04:13

In portal engine, we can always set "Display to roles" property to manage the webpart is only shown to certain roles. However, when I work in ASPX templates mode, I could not find this property in the webpart.

What is the best way to do this in ASPX templates?

Kentico: version 8

Recent Answers


Brenden Kehren answered on January 30, 2015 05:04

Question: "What is the best way to do this in ASPX templates?"
Answer: Use portal mode and create a webpart.

3 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 30, 2015 05:05

All ASPX mode joking aside...

If you MUST use ASPX mode:

panel.Visible = CMS.Membership.MembershipContext.AuthenticatedUser.IsInRole("YourRole");
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.