How Can I put span tag inside RESX file?

Amr Elnashar picture Amr Elnashar · Jul 15, 2010 · Viewed 11.6k times · Source

I have an xml file named "Strings.resx" for translation. I want to make some text highlighted I tried to put span something like this:

<span style="background: red;color: #000000;">VERDERGAAT</span>

and it doesn't work.

Answer

Ian Campbell picture Ian Campbell · Sep 14, 2013


I'm using ASP.NET 4.5 MVC 4, and with razor you can keep HTML tags in a .resx file like so:

<span style="background: red;color: #000000;">VERDERGAAT</span>


...and parse it correctly with @Html.Raw(Resources.MyResourceFile.ValueName).