4

I have a model with a Property "Price" which has the DisplayAttribute

[Display(Name = "Price (in €)")]

Now i want to display this in a table header using

@Html.DisplayNameFor(model => model.Price)

But when the column is very small, the Text might be broken into two Lines:

Price (in
€)

But i want it to break this way:

Price
(in €)

Is it possible to insert a non breaking space into the Display attribute? Using "Price (in €)" results in the " " printed as Text.

wertzui
  • 5,148
  • 3
  • 31
  • 51

1 Answers1

6

Andrei posted the correct Answer in the comments: Non breaking space is a unicode character, with code 00a0. So this should work:

[Display(Name = "Price (in\u00a0€)")]
wertzui
  • 5,148
  • 3
  • 31
  • 51