Reputation: 3450
I have the following label:
@Html.LabelFor(m => m.Data, "text1 / text2", null)
I want to move text2
on new line.
@Html.LabelFor(m => m.Data, "text1 /\r\n text2", null)
and
@Html.LabelFor(m => m.Data, "text1 /<br/> text2", null)
didn't help me.
Is there way to do that?
Upvotes: 1
Views: 719
Reputation: 2090
Yes it's possible using the tag helpers:
@Html.Raw(HttpUtility.HtmlDecode(Html.LabelFor(m => m.Data, "text1 / <br />text2", null).ToString()))
Upvotes: 1
Reputation: 1271
You can use a TextAreaFor and set a readonly property to it:
<%=Html.TextAreaFor(m => m.Data, new { rows="1", style = "border: 0 none white; background-color:#EEF3FB; color: #424242; width:280px; margin:3px;", @readonly = "readonly", @disabled = "disabled", })%>
Upvotes: 0
Reputation: 23
Try the following as the Raw keyword will allow you to embed html:
@Html.Raw(Html.LabelFor(m => m.Data, "text1 /<br/> text2", null))
Upvotes: 0