Pregunta

He intentado conseguir el siguiente ayudante para el trabajo ... pero estoy rascándome la cabeza.

@helper SimpleHelper()
{
    string message;
    message="<b>Hello</b>";
    @message
}

El texto sale incorrectamente codificado. Con el lt; y gt; en lugar de las etiquetas HTML.

Ni WriteLiteral (mensaje) o @:. Mensaje de trabajo

¿Fue útil?

Solución

Use the Html.Raw() helper in Razor to display that as an un-encoded string.

Here's the Razor quick-reference that Phil Haack put together recently.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top