This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Label Inside EditorTemplate Disappears During Validation #2778
Closed
Description
I am using ASP.net MVC 6 and the following EditorTemplate:
<div class="form-group">
@Html.LabelFor(m => m, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
</div>
</div>
When attempting to save the form with a deliberate error, the page refreshes and correctly shows the validation error but the label completely disappears. It is not hidden it is completely gone from the html source.
Here is my EditorFor:
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
A bug?