Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 来自ID MVC的查找名称_C#_Model View Controller - Fatal编程技术网

C# 来自ID MVC的查找名称

C# 来自ID MVC的查找名称,c#,model-view-controller,C#,Model View Controller,我目前使用下面的Razor语法从CaseStatus表中获取“Status”的名称。我将其用于视图中的DropDownListFor选项。现在,我想显示相同的数据,但用于标签。有没有一种简单的方法可以复制标签 @Html.DropDownListFor(m => m.CaseMaster.CaseStatusId, new SelectList(Model.CaseStatus, "Id", "Name"), "Select Status", new { @class = "form-co

我目前使用下面的Razor语法从CaseStatus表中获取“Status”的名称。我将其用于视图中的DropDownListFor选项。现在,我想显示相同的数据,但用于标签。有没有一种简单的方法可以复制标签

@Html.DropDownListFor(m => m.CaseMaster.CaseStatusId, new SelectList(Model.CaseStatus, "Id", "Name"), "Select Status", new { @class = "form-control col-sm" })
仅此而已:

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

(虽然HTML中的
有一个特定的目的,用于引用其他输入元素(即
for=“”
属性)或子输入元素。如果您的意思是“标签”,就像VB/WPF一样,它是屏幕上显示的一小段文本,那么您只需执行
@(this.Model.CaseStatus)
直接执行。

在执行此操作时,我收到System.Collections.Generic.List`1[Clope.Models.CaseStatus]。您还有其他建议吗?