Jun 11, 2018

asp.net core 2.0 DataFormatString DisplayFor

Propert display formatting that worked in ASP.NET Core 2.0 :

                        <span class="room-price">@(Html.DisplayFor(m => rate.Price))&euro;</span>

[DisplayFormat(DataFormatString = "{0:#,###.00}", ApplyFormatInEditMode =false, NullDisplayText ="")]
public decimal Price { get; set; }       

Important!  Don't use DisplayTextFor!

No comments:

Post a Comment