Asp.net mvc how to change the default label text in @html.labelfor
asp.net, asp.net-mvc, razor
Solution
Use this overloaded `LabelFor` method
@Html.LabelFor(model => model.SpendAmount, "Spent $", htmlAttributes: new { @class = "control-label col-md-2" })
Problem
So using annotations my default label for a field is `[Display(Name = "Spent")]` But of course depending on the context the field is displayed in I would like to change it in the View to say "Spent $". For the label, MVC5 scaffolding generates... `@Html.LabelFor(model => model.Spend Amount, htmlAttributes: new { @class = "control-label col-md-2" })` and so the label is "Spent". How can I make it "Spent $" in the view..??