View Users
Display information about a user or a list of users
The View User app is used to display details about a single user or to show a list of users, either preselected users or user groups, users by customer numbers or impersonation. The settings available:
Here you must:
- Decide what information to display from the section Show
- Choose templates to render that information
Templates
The List template should inherit the UserListViewModel and use the Dynamicweb.Rendering and Dynamicweb.Frontend namespaces.
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.UserListViewModel>
@using Dynamicweb.Rendering
@using Dynamicweb.Frontend
<ul>
@foreach (var user in Model.Users)
{
<li>
@Model.UserName
</li>
}
</ul>
Detail template
The Detail template should inherit the UserViewModel and use the Dynamicweb.Rendering and Dynamicweb.Frontend namespaces. Use the properties from the ViewModel to display information about the user:
@inherits ViewModelTemplate<UserViewModel>
@using Dynamicweb.Rendering
@using Dynamicweb.Frontend
<ul>
<li> Name: @Model.Name </li>
<li> Username: @Model.UserName </li>
<li> Address: @Model.Address </li>
@if (!string.IsNullOrWhiteSpace(Model.Image))
{
<li> Profile picture:</li>
<li>
<img src="@Model.Image" alt="@Model.UserName"/>
</li>
}
</ul>