ID MVC中的查找名称

问题描述 投票:0回答:1

我目前使用下面的Razor语法从CaseStatus表中获取“状态”的名称。我将其用于View中的DropDownListFor选项。我现在想显示相同的数据,但要显示标签。是否有简单的方法可以将其复制为标签?

@Html.DropDownListFor(m => m.CaseMaster.CaseStatusId, new SelectList(Model.CaseStatus, "Id", "Name"), "Select Status", new { @class = "form-control col-sm" })
c# model-view-controller
1个回答
0
投票

仅此:

<label>@( this.Model.CaseStatus )</label>

(尽管HTML中的<label>具有用于引用其他输入元素(即for=""属性)或子输入元素的特定目的。屏幕上显示一小段文字,您可以直接执行@( this.Model.CaseStatus )

© www.soinside.com 2019 - 2024. All rights reserved.