CurlyFro
CurlyFro

Reputation: 1882

What's the equivalent of @Html.Raw in Postal?

I'm running Postal from a service. My @Message has html. @Html.Raw is not available. When Postal runs my templated view, I get HtmlEncoded html. does anyone know how to fix this?

Upvotes: 6

Views: 1584

Answers (2)

Jozef Benikovský
Jozef Benikovský

Reputation: 1141

You can use:

@(new System.Web.HtmlString(StringToBeEncoded))

which is basically the same as does HtmlHelper.Raw(StringToBeEncoded) method under the hood. Moreover, you will not get any error in Visual Studio for the templates.

Upvotes: 1

MattWazEre
MattWazEre

Reputation: 213

In our service, we've used:

@Raw(StringToBeEncoded)

In the html template it will complain it can not be resolved, but at runtime @Raw works fine. Its part of RazorEngine.

Upvotes: 5

Related Questions