Trying to set visibility of menu item based on a Role

Bit stuck on what is probably a simple thing

Attempting to show hide menu items based upon current user's Role(s)

<RadzenPanelMenuItem Text="Statuses" Path="statuses" Visible="Security.IsInRole('Admin')"/>

Grateful if anyone could unblock me - Cheers!

1 Like

C# cannot use ' for strings. It should be "Admin" instead of 'Admin'.

1 Like

Just set it up like this: Visible='@Security.IsInRole("Admin")'
and it will work fine. Also make sure to add a reference to your Services namespace. You can do this by adding a using to the top of the rador page like @using VisionSuiteAccounting.Services as in my case. And as Mr. Korchev said, the function only looks at maximum 2 roles as the arrayt is not dynamic.