DOT

VVM

 DOCS

Version: 1.0 | 1.1 |

RoleView

in namespace DotVVM.Framework.Controls

Renders different content to the users which are in a specified role and users which are not.

Properties

Name Type Description Notes Default Value
ClientIDMode ClientIDMode Gets or sets the client ID generation algorithm.
attribute
inner element
static value
bindable
default
1
DataContext Object Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value.
attribute
inner element
static value
bindable
default
HideNonAuthenticatedUsers Boolean
attribute
inner element
static value
bindable
default
True
ID String Gets or sets the unique control ID.
attribute
inner element
static value
bindable
default
InnerText String Gets or sets the inner text of the HTML element.
attribute
inner element
static value
bindable
default
IsMemberTemplate ITemplate Gets or sets the content displayed to the users which are in one or more roles specified by the Roles property.
attribute
inner element
static value
bindable
default
IsNotMemberTemplate ITemplate Gets or sets the content displayed to the users which are not in any of the roles specified by the Roles property.
attribute
inner element
static value
bindable
default
RenderWrapperTag Boolean Gets or sets whether the control should render a wrapper element.
attribute
inner element
static value
bindable
default
False
Roles String[] Gets or sets a comma-separated list of roles. The user must be a member of one or more of these roles.
attribute
inner element
static value
bindable
default
Visible Boolean Gets or sets whether the control is visible.
attribute
inner element
static value
bindable
default
True
WrapperTagName String Gets or sets the name of the tag that wraps the Repeater.
attribute
inner element
static value
bindable
default
div

Events

Name Type Description

Usage & Scenarios

Allows to display different content to users that are member of a specific role.

HTML Rendered by the Control

The control renders the contents of the IsMemberTemplate or IsNotMemberTemplate 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 IsMemberTemplate or IsNotMemberTemplate -->
</div>

Sample 1: RoleView

The Roles property contains a comma-separated list of roles.

The IsMemberTemplate defines the content displayed to the users who are member of at least one of the role in the Roles property.

The IsNotMemberTemplate 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 IsNotMemberTemplate even to the anonymous users, set the HideForAnonymousUsers property to false.

<dot:RoleView Roles="admin,moderator,tester">
  <IsMemberTemplate>
    I am a member.
  </IsMemberTemplate>
  <IsNotMemberTemplate>
    I am not a member.
  </IsNotMemberTemplate>
</dot:RoleView>

Suggestions


Help & Contribute

The documentation is maintained on GitHub.
We'll be happy if you edit the page and create a pull request.

Send message