Mark
Mark

Reputation: 7818

Line break in DisplayName

I'm using asp.net MVC 4 with VB.Net and Razor.

In my model, I have:

Public Class MPEmployee

Public Property ID() As Integer
<DisplayName("Staff<br />Name")>

... .. .

Is there any way of keeping the line break when I display the label for the column in my views:

<th>
  @Html.DisplayNameFor(Function(model) model.StaffName) 
</th>

Thanks for any help,

Mark

Upvotes: 1

Views: 1478

Answers (1)

archil
archil

Reputation: 39491

Let view and html deal with breaking text into lines. If you give that th small enough width, it will automatically place Name on second line

Public Property ID() As Integer
<DisplayName("Staff Name")>

...

<th style="width:50px">
    @Html.DisplayNameFor(Function(model) model.StaffName) 
</th>

Upvotes: 2

Related Questions