Skip to content

Sample: MVC Views Test Details

Mendz edited this page Oct 8, 2017 · 2 revisions

Create a file named Details.cshtml and enter the following:

@model TestModels.Test

@{
    ViewData["Title"] = "Details";
}

<h2>Details</h2>

<div>
    <h4>Test</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.TestID)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.TestID)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.Code)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.Code)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.Name)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.Name)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.Description)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.Description)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.CreatedBy)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.CreatedBy)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.CreatedDate)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.CreatedDate)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.ModifiedBy)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.ModifiedBy)
        </dd>
        <dt>
            @Html.DisplayNameFor(model => model.ModifiedDate)
        </dt>
        <dd>
            @Html.DisplayFor(model => model.ModifiedDate)
        </dd>
    </dl>
</div>
<div>
    @Html.ActionLink("Edit", "Edit", new { id = Model.TestID }) |
    <a asp-action="Index">Back to List</a>
</div>