Render a string with HTML elements?

4

My concern is that I have a string in my database in the following way:

'<a href="#" id="Manuel">@Manuel</a>&nbsp;hola'

When I have it in my model, it appears in the same way, and when I want to render the view it is shown that it is in the database, I do it in the following way:

<div>@Model.evento[0].Notas_Inicio</div>

How can I show it as if it belongs to DOM of the page?

    
asked by JuankGlezz 11.11.2016 в 19:07
source

1 answer

6

What I did was change the way the chain is displayed, for that use HtmlHelper.Raw of Razor .

Then my div stayed as follows:

<div>@Html.Raw(@Model.evento[0].Notas_Inicio)</div>
  

Warning: If Notas_Inicio can be modified by a user, this opens the possibility that they insert arbitrary code into your page as malicious scripts. - Equidad

    
answered by 11.11.2016 / 19:07
source