Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kate 267 posts 610 karma points
    Feb 05, 2014 @ 10:07
    Kate
    0

    Html.Raw or not

    I have trouble understanding what Html.Raw is for.

    In my scriptfile, can I just write this:

    @Model.bodyText

    or do I have to write:

    @Html.Raw(@Model.bodyText)

    What is the best way to get the content from a property with datatype Richtext editor?

    /Kate

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 05, 2014 @ 10:26
    Fuji Kusaka
    100

    If you are using Rte its best not to use Html.Raw

    Here some more explantions http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5.aspx

    However if you want to get ride of p tag when rendering the rte you can do this

    Library.StripHtml(Model.BodyText, "p") 
    
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 05, 2014 @ 10:27
    Dennis Aaen
    1

    Hi Kate,

    I think this documentation http://umbraco.tv/videos/implementor/working-with-umbraco-data/razor-syntax/htmlraw/documentation/ will give an good explanation when you have to write

    @Html.Raw(@Model.bodyText)

    And when you just can use:

    @Model.bodyText

    Here is a video also that explains it: http://umbraco.tv/videos/implementor/working-with-umbraco-data/razor-syntax/htmlraw/

    /Dennis

  • Kate 267 posts 610 karma points
    Feb 05, 2014 @ 10:41
    Kate
    0

    Hi

    Thanks to both of you. Now I have a bit of reading to do :-)

    /Kate

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies