I was just looking for this today as well. I found there is now an HtmlHelper:
@Html.ReplaceLineBreaksForHtml(multiLine)
Note that it returns HtmlString, not string!
I initially copied the v7 string extension but had to revisit where I was using it, so I was searching for my extension (same name) and happened to find the HtmlHelper in /Views/Partials/Grid/Editors/Textstring.cshtml
Replace line break for Text area in Umbraco 8
What is alternative method for mutliline text area line brakes in umbraco 8.
In Umbraco 7, we had the following extension method in umbraco helper.
Thanks in advance
Regards,
Sumesh KP
Hi Sumesh,
I tend to just add
.Replace(Environment.NewLine, "<br />")
to the output soor
Lewis
I was just looking for this today as well. I found there is now an HtmlHelper:
Note that it returns
HtmlString
, notstring
!I initially copied the v7 string extension but had to revisit where I was using it, so I was searching for my extension (same name) and happened to find the HtmlHelper in
/Views/Partials/Grid/Editors/Textstring.cshtml
Now it's:
Html.ReplaceLineBreaks(text);
ReplaceLineBreaksWithHtml is deprecated
J
I can't believe this isn't in the docs.
TRY new HtmlStringUtilities().ReplaceLineBreaks()
is working on a reply...