Black Eagle
Black Eagle

Reputation: 1117

passing a string with line break on to a cshtml page

I have a mypage.cshtml as below

<p><span>@r.get("My_Message")</span></p>

Below is my entry in my resx file

<data name="my_message" xml:space="preserve">
<value>This is first line &lt;br/&gt; This is my second line &lt;br/&gt;</value>
</data>

When i run mypage.cshtml , my line break char for the above string is not working . please help

The output I am getting is

This is first line <br/> This is my second line <br/>

I don't know why lines are not breaking I need an output as below

This is first line
This is my second line

Upvotes: 2

Views: 8630

Answers (1)

mccow002
mccow002

Reputation: 6904

Try:

<p><span>@Html.Raw(HttpUtility.HtmlDecode(r.get("My_Message")))</span></p>

Upvotes: 8

Related Questions