r.r
r.r

Reputation: 7173

asp.net mvc - show content from string with html

in my Model I have a string property Feeds with value like that:

<img src="/Images/Company/twitter.png" style="border:0; vertical-align:text-bottom;"/>
&nbsp;
<b>
    9/29/2010 1:01:33 PM
</b>
<br/>
How to get started building rich #VS2010 #VSPackage based extensions - 
<a href="http://bit.ly/a8ksc1" target="_NEW">
    http://bit.ly/a8ksc1
</a>
<br/>&nbsp;<br/>
<img src="/Images/Company/twitter.png" style="border:0; vertical-align:text-bottom;"/>
&nbsp;
<b>    
    9/3/2010 9:51:26 AM
</b>
<br/>
Windows Phone 7 – Released To Manufacturing 
<a href="http://bit.ly/a7HHvw" target="_NEW">
    http://bit.ly/a7HHvw
</a>
<br/>&nbsp;<br/><br/>
<img src="/Images/Company//rss.png" style="border:0; vertical-align:text-bottom;"/>
&nbsp;RSS feed to busy :-(
<br/>

How can I show it like html in my view?? I can get it out in textArea, but i want to just to show it like html.

<%= Html.TextAreaFor(obj => obj.Feeds, 60, 40, null) %>

Upvotes: 1

Views: 2237

Answers (2)

Muhammad Adeel Zahid
Muhammad Adeel Zahid

Reputation: 17794

you can use

<%=Html.Encode(Model.Feeds)%>

this will encode ur tags to html equivalent codes and they will not be interpreted when rendering them on the web page.

Upvotes: 0

Clicktricity
Clicktricity

Reputation: 4209

<%= Model.Feeds %>

Upvotes: 5

Related Questions