I thought I have asked this before, but I am not finding it. I am making partial view for a form so I can use it in multiple places. Here is one short snippet:
@model Permits.Domain.Entities.PermitRequest
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<div class="editor-label">
@Html.LabelFor(model => model.JobAddress)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.JobAddress)
@Html.ValidationMessageFor(model => model.JobAddress)
</div>
<p>
<input type="submit" value="Submit request" />
</p>
</fieldset>
}
My model looks like:
public class PermitRequest
{
[Description("Job address")]
public string JobAddress { get; set; }
}
Why would my label still be “JobAddress” instead of “Job Address” (with the space)? I feel like I am missing something obvious.
or if you prefer:
Both set the
DisplayNameproperty of the ModelMetadata which is used by the LabelFor helper.