dimanche 28 juin 2015

how to render text inside by using Html.raw in mvc view

I am trying to display html text from database and show it in view. Example: In my database:

<p>
    <strong>Stackoverflow</strong></p>
<p>

In View: Stackoverflow

and I use @Html.raw(myproperty) But the problem is The text it's not render inside div.

Here is my code in index page:

 <p style="word-wrap: break-word;overflow:hidden;white-space: nowrap;text-overflow:ellipsis">
    @Html.Raw(item.Body)
</p>

Here is my screenshot about the problem: enter image description here

Please help me. Many thanks.

Aucun commentaire:

Enregistrer un commentaire