Alex
Alex

Reputation: 1061

C# - reading and displaying HTML from resources

.NET 4, VS 2010, C#, MVC 3.

In my resource file, I have:

First line.<p />Second line.

I'm reading it from the view via Razor:

@Translations.Example

But my p's stay p's - in other words, they don't get rendered as HTML.

Why?

Upvotes: 13

Views: 10301

Answers (3)

Sa&#226;d Haffar
Sa&#226;d Haffar

Reputation: 143

Try this: @Html.Raw(YourResourceFile.KeyInTheResourceFile)

Upvotes: 0

Amir Ismail
Amir Ismail

Reputation: 3883

try to use Raw extension method

@Html.Raw(Translations.Example)

Upvotes: 6

Daniel A. White
Daniel A. White

Reputation: 190952

Do

@Html.Raw(Translations.Example)

Upvotes: 19

Related Questions