我有一个带有属性"Price“的模型,其中包含DisplayAttribute
[Display(Name = "Price (in €)")]现在,我希望在表标题中使用
@Html.DisplayNameFor(model => model.Price)但是,当列非常小时,可能会将文本分成两行:
Price (in
€)但我想让它打破这条路:
Price
(in €)是否可以在显示属性中插入非中断空间?使用"Price (in €)“将" ”作为文本打印出来。
发布于 2014-11-12 07:44:22
Andrei在评论中给出了正确的答案:非中断空间是unicode字符,代码为00a0。所以这应该是可行的:
[Display(Name = "Price (in\u00a0€)")]https://stackoverflow.com/questions/26844652
复制相似问题