The only thing to be aware of is you need to have @inherits UmbracoViewPage<TModel> in your view instead of just @model TModel since Umbraco applies some custom logic to IHtmlEncodedString and will ensure there it's written without encoding again, see the source. Not sure why Umbraco doesn't just use ASP.NET Core's IHtmlString though and wanted to come up with their own version, looks like they serve the same purpose.
We are trying to use it in a partial view.
...oh I didn't realise you could use
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel> in a partial view.
yea that works.
It still seems a bit odd not to use HtmlString.
Why IHtmlEncodedString instead of HtmlString or IHtmlString?
In a vanilla v9 project I would output content from an RTE like so:
In a vanilla v8 project I would do this:
The v9 way seems error-prone and a waste of everyone's keystrokes.
This is because a (non-standard)
Umbraco.Cms.Core.Strings.IHtmlEncodedString
is used in v9 where aSystem.Web.IHtmlString
was used in v8Can we change back to the v8 way?
Hi Murray,
I'm not using Html.Raw for displaying RTE fields. That works just fine for me.
Dave
The only thing to be aware of is you need to have
@inherits UmbracoViewPage<TModel>
in your view instead of just@model TModel
since Umbraco applies some custom logic toIHtmlEncodedString
and will ensure there it's written without encoding again, see the source. Not sure why Umbraco doesn't just use ASP.NET Core'sIHtmlString
though and wanted to come up with their own version, looks like they serve the same purpose.We are trying to use it in a partial view. ...oh I didn't realise you could use
@inherits Umbraco.Web.Mvc.UmbracoViewPage<MyModel>
in a partial view.yea that works.
It still seems a bit odd not to use HtmlString.
still unsure why Umbraco doesn't use the core HtmlString datatype?
is working on a reply...