1

I want to render a string so that if the string includes a "br" tag, it doesn't break the line and show br tag as text:

    public RazorLight.Text.RawString PrintValueOrEmpty()
    {
        if (Value == null)
        {
            return new RazorLight.Text.RawString(string.Empty);
        }

        var html = $@"<p class=""text-row"">{Value}</p>";
        return new RazorLight.Text.RawString(html);
    }

And when I use PrintValueOrEmpty() in cshtml and when a string contains a br tag, it breaks the line which I don't want

<td>@Model.GeneralInformation.Comment.PrintValueOrEmpty()</td>
random_hooman
  • 1,660
  • 7
  • 23
tad
  • 21
  • 3

0 Answers0