MVC视图显示字段标题不是字段内容

时间:2014-04-10 12:03:39

标签: asp.net-mvc asp.net-mvc-4 razor

我有一个详细信息视图,我只想显示从数据库中检索的内容。我不想在视图中看到字段的标题(标签)。 这是我的观点代码:

@model SozlukRG.Models.KelimeTuru

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>


<fieldset>

    <legend>KelimeTuru</legend>
    <div class="div1" style="display: table; background-color: #b0c4de;">
        <div class="div1" style="display: table-row;">
            <div class="div1" style="display: table-cell; padding: 10px;">
                <div class="display-field">
                    @Html.DisplayNameFor(model => model.Kelime.Kelime1)
                    </div>
                </div>

            <div class="div1" style="display: table-cell; padding: 10px;">
                <a href="/Audio/@Model.Ses.Adi"> <img src=" http://www.seslisozluk.net/img/pronunciation.png" /></a>
            </div>
            </div>
        <div class="div1" style="display: table-row;">
            <div class="div1" style="display: table-cell; padding: 10px;">
                <div class="display-field">
                    @Html.DisplayNameFor(model => model.Anlam)
                    </div>
                </div>
            </div>
        <div class="div1" style="display: table-row;">

            <div class="div1" style="display: table-cell; padding: 10px;">
                <img src='/Resim/Show/@Model.Id'>
            </div>
            </div>
        <div class="div1" style="display: table-row;">
            <div class="div1" style="display: table-cell; padding: 10px;">
                <video width="320" height="240" controls>
                    <source src="/Videos/@Model.Video.Adi" type="video/mp4">

                </video>
            </div>

        </div>
        </div>
    <div class="display-field">
        @Html.DisplayNameFor(model => model.Kelime.Kelime1)
    </div>


</fieldset>
<p>

    @Html.ActionLink("Back to List", "Index")

</p>

model.Kelime.Kelime1和model.Anlam 正在检索字段的标签。 但是,他们应该检索字段内容。 你能帮我纠正一下我的代码吗?

1 个答案:

答案 0 :(得分:1)

这样做:

<div>@Model.Anlam</div>

@Html.TextBoxFor(model => model.Anlam)