v8-9: IHtmlString not recognised
Closed this issue · 0 comments
LottePitcher commented
In a few view models in the v8 site we used a IHtmlString
property (in System.Web
) usually to hold the content from a rich text editor.
v8
public IHtmlString Text { get; set; }
And then the property displays correctly in a view using:
@Model.Text
v9
IHtmlString doesn't exist any more, but we discovered IHtmlEncodedString
, in Umbraco.Cms.Core.Strings
so used:
public IHtmlEncodedString Text { get; set; }
which we figured should do the job. However @Model.Text
was now displaying the encoded version of the string, so we needed to use:
@Html.Raw(Model.Text)
With hindsight it feels a bit odd that the v8 version didn't need the Html.Raw method, but hey ho!