ClaimView
in namespace DotVVM.Framework.Controls
Usage & Scenarios
Allows to display different content to users who have a specific claim.
Sample 1: ClaimView
The Claim
property specifies the type of claim the user must have.
The Values
property optionally contains a comma-separated list of accepted values. If it is missing, all values are accepted.
The HasClaimTemplate
defines the content displayed to the users who have the Claim
with at least one of accepted values.
The HasNotClaimTemplate
defines the content displayed to other users.
By default, the control is hidden completely to the users who are not authenticated. If you want to display the HasNotClaimTemplate
even to the anonymous users, set the HideForAnonymousUsers
property to false
.
<dot:ClaimView Claim="Permission" Values="CanAddUsers" HideForAnonymousUsers="false">
<HasClaimTemplate>
I can add new users.
</HasClaimTemplate>
<HasNotClaimTemplate>
I can't add new users.
</HasNotClaimTemplate>
</dot:ClaimView>
HTML produced by the control
The control renders the contents of the HasClaimTemplate
or HasNotClaimTemplate
property. Optionally you can enable wrapper tag rendering using
the RenderWrapperTag
property. The tag name can be changed using the WrapperTagName
property.
<div>
<!-- Contents of the HasClaimTemplate or HasNotClaimTemplate -->
</div>