C# .Net在模型显示属性的标签中使用html标记

C# .Net在模型显示属性的标签中使用html标记,c#,html,.net,asp.net-mvc,model-view-controller,C#,Html,.net,Asp.net Mvc,Model View Controller,我正在尝试根据联系人表单模型中显示的各种字段创建一个HTML表单。但是,在字段的标签属性中,我想使用一些HTML标记,例如和,来区分标签的各个部分,即,我想要的HTML是: <label for="error"> <strong>Error</strong> - Has the app stopped working? <span class="small">Did the app crash whilst run

我正在尝试根据联系人表单模型中显示的各种字段创建一个HTML表单。但是,在字段的
标签
属性中,我想使用一些HTML标记,例如
,来区分
标签
的各个部分,即,我想要的HTML是:

<label for="error">
     <strong>Error</strong>  
     - Has the app stopped working?
     <span class="small">Did the app crash whilst running?</span>
</label>
视图:


我似乎无法在
name
属性中添加HTML,而且这样做看起来也很混乱-有没有其他方法可以这样做?

只需在视图中添加HTML即可。不要使用helper方法HtmlHelpers对输出进行编码,因此需要手动执行此操作
[Display(Name = "Has the app stopped working?")]
public string Error{ get; set; }
@Html.LabelFor(model => model.Error, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Error, new { htmlAttributes = new { @class = "email form-control" } })
@Html.ValidationMessageFor(model => model.Error, "", new { @class = "text-danger" })