I have a model class similar to the following:
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; using System.Web.Mvc; [System.Runtime.Serialization.DataContract(IsReference = true)] [System.ComponentModel.DataAnnotations.ScaffoldTable(true)] public class TestModel { [Display(Name="Schedule Name")] [Required] public string scheduleName; }
And in my .cshtml file I have:
<li> @Html.LabelFor(m => m.scheduleName) @Html.TextBoxFor(m => m.scheduleName, Model.scheduleName) @Html.ValidationMessageFor(m => m.scheduleName) </li>
But for some reason, my display name is not displayed (the label shows "scheduleName")
I swear I have the same code in other classes, and it seems very good. Can someone please indicate the reason why this will not work?
source share