6

I've a String field on my model that contains an html value, my problem is that when I place the code to render this field on my view it will be entirely reconverted to html, and the final result is a big string with html characters escaped...

@field //= "<div>"

renders

 &lt ;div&gt ;

How can i override this behavior and force it to write the html unescaped on my field?

1

2 Answers 2

15

You could use the Html.Raw helper:

@Html.Raw(field)
Sign up to request clarification or add additional context in comments.

Comments

3

Use @Html.Raw:

@Html.Raw(field)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.