Copied to clipboard

Flag this post as spam?

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


  • René Andersen 238 posts 684 karma points
    Mar 20, 2015 @ 10:06
    René Andersen
    0

    Partial view macro (Textarea type) line break

    Hi

    Is it possible to make linebreaks in the Partial view macro textarea type?

    I does not work when hitting enter og inserting a <br>

    // René

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Mar 20, 2015 @ 10:24
    Dennis Aaen
    1

    Hi René

    When you are using the multiple textbox, and add HTML into it and want to outputted in your Partial view macro then you need to use the @Html.Raw()

    So try this.

    If you are using dynamic Razor.

    @Html.Raw(CurrentPage.PropertyAlias)

    And if you are using strongly typed Razor

    @Html.Raw(Model.Content.GetPropertyValue("PropertyAlias"))

    Hope this helps,

    /Dennis

  • René Andersen 238 posts 684 karma points
    Mar 20, 2015 @ 12:04
    René Andersen
    0

    Hi Dennis

    I have one of those days where anything is difficult....Even the easy stuff. :-)

    Please see this code which gives me a output without line-breaks:

    <div class="collapse" id="@Model.MacroParameters["buttonId"]">
    <div class="well">
    <p>@Model.MacroParameters["text"]</p>
    </div>
    </div>

    Where and how will you insert your code?

    // René

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    Mar 20, 2015 @ 12:59
    Dennis Aaen
    2

    Hi René

    I thought that you were using the multiple textbox property type in Umbraco, then if you write some code into this like a <script> tag and want to print out the script tag, then you can use the Html.Raw function. If you have access to Umbraco TV, there is an episode about the @Html.Raw() http://umbraco.tv/videos/implementor/working-with-umbraco-data/razor-syntax/htmlraw/

    Hope this make sense.

    /Dennis

  • René Andersen 238 posts 684 karma points
    Mar 20, 2015 @ 13:16
    René Andersen
    1

    Hi Dennis

    After watching UmbracoTV I made this solution.

    @{ var someHtml = Model.MacroParameters["text"];}
    <div class="collapse" id="@Model.MacroParameters["buttonId"]">
    <div class="well">
    <p>@Html.Raw(someHtml)</p>
    </div>
    </div>

    Thanks!

    // René

  • 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