Question

We are using mvc 2.0 We are getting the body from db where its stored in this format

 (strore in db as varchar) 
"<p>Thank you for submitting your feedback about recent experience</p>  
<p>Regards,</p>  
<p>The XYZ team</p>"

 (This is what I am trying on View)
 <div>
            <%= Html.TextAreaFor(dataModel => dataModel.body, new { @class ="row-class", @rows = 20 })%>
</div>

Currently the content is displayed with HTML tags in the TextArea, which I dont want. I just want to display the formated text as per the html. I have tried couple of things like @Html.Raw but in vein. If anyone has gone through this kind of issue please let me know or any article which can lead me in right direction will also help..

Thanks for your time..

Était-ce utile?

La solution

Have you tried simply <%= Model.Body %>

Autres conseils

To display that as html, try @Html.Raw(Model.body) (or Model.body, whatever is name of your property).

To edit html, you need a html editor. I used TinyMce for that, and I was happy with it.

There is even a nuget package with it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top