What I mean is, e.g.
[DataType(DataType.Text)]
[Display(Name = "Corporation / Entreprise")]
public string Corporation { get; set; }
Would it be possible to apply a line break after the '/' in the Name of the Display attribute? So when the View page displaying the label value which set in the Model:
<td style="font-weight:bold">
@Html.DisplayNameFor(model => model.Corporation)
</td>
It would show something like:
Corporation /
Entreprise
Instead of
Corporation / Entreprise
Thanks in advance.
CodePudding user response:
Add the <br/>
attribute in displayattribute and display it as Html.Raw
in the view. like this:
Model:
[DataType(DataType.Text)]
[Display(Name = "Corporation / <br/> Entreprise")]
public string Corporation { get; set; }
View:
<td style="font-weight:bold">
@Html.Raw(@Html.DisplayNameFor(model => model.Corporation))
</td>
Test Result: