Reputation: 10709
In my ASP MVC ViewModel, I have the following properties that are using the DisplayName
identifier
[DisplayName("Payment Frequency")]
public char paymentFrequency { get; set; }
[DisplayName("Account Type")]
public char accountType { get; set; }
However when they are called by the DipslayFor
helper in the view like so
<div class="M-editor-label">
@Html.DisplayFor(model => model.paymentFrequency)
</div>
<div class="M-editor-label">
@Html.DisplayFor(model => model.accountType)
</div>
I get a big ol' blank space. Any idea why?
Upvotes: 1
Views: 112
Reputation: 5443
The DisplayName is the Label Display value ->
use @Html.LabelFor(m => m.paymentFrequency)
you're getting blanks because you have empty properties i'm guessing.
Usually you use LabelFor and DisplayFor with eachother to display the label and the value.
Upvotes: 3