3

I have text in my database that is html encoded.

In order to display it on a normal view, I use the technique described here -

@Html.Raw(encodedHtmlString)

and it displays as expected.

However, when I do the same thing in a partial view, and then render that view with .Partial or .RenderPartial, the text is still encoded, even though the partial view renders it with @Html.Raw().

How do you prevent the parent view from encoding text rendered in a partial view?

Community
  • 1
  • 1
Joe Enzminger
  • 11,110
  • 3
  • 50
  • 75

1 Answers1

1

Try this instead:

@Html.Raw(Html.Partial("your view name"))

Hope this will help !!

Kundan Singh Chouhan
  • 13,952
  • 4
  • 27
  • 32