Table of Contents

Class UserViewDetailViewModel

Namespace
Dynamicweb.Users.Frontend.UserView
Assembly
Dynamicweb.Users.dll

View model for the UserView detail template.

public sealed class UserViewDetailViewModel : UserViewModel
Inheritance
UserViewDetailViewModel
Inherited Members
Extension Methods

Examples

Razor detail template usage:

@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserView.UserViewDetailViewModel> @using Dynamicweb.Users.Frontend.UserView

@{ // The edit link comes directly from the model: string? editProfileLink = Model.EditUserLink; }

<header class="hstack gap-3 mb-4"> <h1 class="h4 mb-0">@(Pageview.Page.GetDisplayName())</h1> @if (!string.IsNullOrEmpty(editProfileLink)) { <a href="@editProfileLink" class="btn btn-link icon-2" title="@Translate("Edit profile")"> @ReadFile("/Files/Images/Icons/pen.svg") </a> } </header>

<div class="card mb-4"> <div class="card-body hstack gap-4 align-items-start p-4"> @if (Model.TryGetImageFile(out ImageFileViewModel? image)) { <div class="align-self-auto hstack justify-content-center p-0" style="height:6rem; aspect-ratio:1;"> <img src="@image.ToGetImage(new(){ Width = 500, Ratio = "1/1" })" alt="@Model.Name" class="img-thumbnail rounded-circle" /> </div> } else { <div class="btn btn-primary rounded-circle align-self-auto hstack justify-content-center p-0 disabled opacity-100" style="height:6rem; aspect-ratio:1;" data-dw-button="primary"> <div class="d-flex dw-h4 lh-1 m-0"> @(Model.GetTwoLetterInitials()) </div> </div> }

    <div class="flex-fill align-self-center">
        <h4 class="mb-1">@Model.Name</h4>
        <div class="text-muted fs-7">
            <span>@string.Join(" - ", new[]{ Model.Title, Model.Company }.Where(s => !string.IsNullOrWhiteSpace(s)))</span>
        </div>
        <div class="text-muted fs-8">
            <span>@string.Join(", ", new[]{ Model.City, Model.Country }.Where(s => !string.IsNullOrWhiteSpace(s)))</span>
        </div>
    </div>
</div>

</div>

<div class="card mb-4"> <div class="card-header bg-body border-0 p-4 pb-0"> <h1 class="card-title h5 mb-0">@Translate("Personal information")</h1> </div> <div class="card-body grid p-4"> <div class="g-col-12 g-col-lg-6 fs-7"> <dl> <dt class="text-muted fw-normal">@Translate("First name")</dt> <dd>@Model.FirstName&lt;/dd&gt; </dl> <dl> <dt class="text-muted fw-normal">@Translate("Email address")</dt> <dd><a href="mailto:@Model.Email">@Model.Email&lt;/a&gt;&lt;/dd&gt; </dl> </div> <div class="g-col-12 g-col-lg-6 fs-7"> <dl> <dt class="text-muted fw-normal">@Translate("Last name")</dt> <dd>@Model.LastName&lt;/dd&gt; </dl> <dl> <dt class="text-muted fw-normal">@Translate("Phone")</dt> <dd><a href="tel:@Model.Phone">@Model.Phone&lt;/a&gt;&lt;/dd&gt; </dl> </div> </div> </div>

Remarks

This model is provided to Razor templates in /Templates/Users/UserView/Detail. It inherits all properties from UserViewModel and adds an EditUserLink property for convenient linking to an edit page.

Templates using this model can display detailed user information (name, contact details, address, etc.) and optionally render an “Edit profile” button if EditUserLink is not null.

To target a specific user in URLs, append ?Secret={user.UniqueId} to the link.

Properties

Gets or sets the resolved link to your “Edit user” page.
Append &Secret={user.UniqueId} to target a specific user.

public string? EditUserLink { get; set; }

Property Value

string

See Also

UserViewSettings
UserViewModelFactory
UserViewListViewModel
To top