Skip to content

RTE - Model.Value<IHtmlContent>("bodyText") outputs nothing #18738

@cheeseytoastie

Description

@cheeseytoastie

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

15.2.3

Bug summary

Testing out V15 - decided to follow the documentation. So I've not setup models builder / typed doc types - just creating a basic site and playing along like a new user would.

To render a RTE I can just use
@Model.Value("bodyText")

This works - but my instinct is to be specific and typeset
https://docs.umbraco.com/umbraco-cms/fundamentals/design/rendering-content#specifying-types-of-data

Says this should be:
<div>@(Model.Value<IHtmlContent>("bodyText"))</div>

However that doesn't render any text. I've found that HtmlEncodedString works:
@(Model.Value<Umbraco.Cms.Core.Strings.HtmlEncodedString>("bodyText"))

  • is the documentation wrong and needs updating or is this a bug?

NOTE - I've tested with both TipTap and Tiny - same result.

Image

Specifics

No response

Steps to reproduce

Create a doc type - add a RTE property. Try to render with type according to the documentation
https://docs.umbraco.com/umbraco-cms/fundamentals/design/rendering-content#specifying-types-of-data

Expected result / actual result

Expected all three razor tags to output the rich text.

RESULT:
Only a non type set and using the Umbraco HtmlEncodedString works.

Not sure if it's just an error in the documentation or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions