razor - asp.net mvc 5 html.DisplayFor DisplayFormat Display(Name) not working -
html.displayfor
stopped displaying display name , formatted string... code bellow ... ideas? have searched around couldn't find anything. thanks
[displayformat(dataformatstring = "{0:mm/dd/yyyy}")] [display(name = "date")] public datetime eventdatetimeday { get; set; } [display(name = "seconds")] [displayformat(dataformatstring = "{0:0.00} s")] public double duration { get; set; }
razor .cshtml:
@model ienumerable<ourclass> ... <th> @html.displaynamefor(model => model.eventdatetimeday) </th> ... @foreach (var item in model) { ... <td> @html.displayfor(modelitem => item.eventdatetimeday) </td>
you should try using displayname attribute
[displayname("seconds")] public double duration { get; set; }
Comments
Post a Comment