Copied to clipboard

Flag this post as spam?

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


  • Andreas Kaltenhuber 107 posts 286 karma points
    Sep 24, 2013 @ 12:54
    Andreas Kaltenhuber
    0

    Problem with Macro Parameter Multiline in Razor

    Hi,

    for a project my content editors want to insert some sort of embed code from different plattforms. for that i created a "embed" macro with parameter textmultiline "embedCode" to use with RTE.

    The correct rendering of the parameter input doesn't work as expected in my razor code:

    <div>@Html.Raw(Parameter.embedCode)</div>
    <div>@Html.Raw(Parameter.embedCode.ToString())</div>

    that outputs the Emebed Code but the Code gets surrended by quotions marks in the HTML:

    <div>"<a href="..">...</a>"</div>

    My Main Razor File in the template checks what to render an then calls @Renderpage(..) to render parts of the page. In one of that scripts the RTE gets rendered by @Html.Raw(umbraco.library.RenderMacroContent(Model.bodyText.ToString(), Model.Id)), tried @Model.bodyText too, but that doesn't change anything in the output for the Macro.

     

    Any Ideas?

     

    thx in advance,
    Andreas

     

    and the strange thing is, that only happens in that installation. Tried that in a clean installation and worked as expected.

    -----------

    Umbraco 6.1.5 (upgraded from 6.0.5), Web Forms

  • Dovile 2 posts 22 karma points
    Jun 26, 2014 @ 13:06
    Dovile
    0

    there was a really good answer in stackoverflow: 

    @Html.Raw(HttpUtility.HtmlDecode(Parameter.Code));

    http://stackoverflow.com/questions/19818223/umbraco-razor-html-escaping-issue

     

    It worked for me at least.

Please Sign in or register to post replies

Write your reply to:

Draft