Copied to clipboard

Flag this post as spam?

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

  • Karima 2 posts 92 karma points
    Jun 05, 2019 @ 10:36

    I added a parameter of type "RTE" in my Macro. but I can't get its value correctly. In the cshtml file, I add this to get the value of the parameter:

    @Html.Raw(TemplateUtilities.ParseInternalLinks(Model.MacroParameters["Introduction"].ToString(), Current.UmbracoContext.UrlProvider))

    but the result is not in html:

    kgkgkkgkg kggkkg
    <br />jjjj.

  • Brandon Osborne 37 posts 160 karma points c-trib
    Jun 06, 2019 @ 10:36
    Brandon Osborne

    Hello There, Karima,

    I would say to first look at the source in your RTE and make sure the HTML isn't coming out HTMLEncoded (i.e. <br /> ). If it is correct it in the HTML or change your code to:

    @Html.Raw(Server.HtmlDecode(TemplateUtilities.ParseInternalLinks(Model.MacroParameters["Introduction"].ToString(), Current.UmbracoContext.UrlProvider)))

    I've seen the RTE occasionally do this and mess up the results that I'm expecting. Let me know if that fixes your issue or if the problem persists.

  • Karima 2 posts 92 karma points
    Jun 06, 2019 @ 10:46

    Hi Brandom,

    Thank you for your response, I found the solution :

    var myString = Model.MacroParameters["Introduction"].ToString();
  • Erik W 4 posts 83 karma points
    Jun 27, 2019 @ 10:41
    Erik W

    Hi, how did you add the RTE in V8?

    I tried to use this guide but cant get it to work:

  • Thomas Beckert 193 posts 469 karma points
    Jun 09, 2021 @ 09:18
    Thomas Beckert

    To Render RTE Content passed by Macro-Paraemter and also render internal links! use this code:

    @using Umbraco.Web.Templates;
    @using Umbraco.Web.Composing;
    @inherits Umbraco.Web.Macros.PartialViewMacroPage
        HtmlLocalLinkParser htmlLocalLinkParser = new HtmlLocalLinkParser(Current.UmbracoContextAccessor);
        string text = Model.MacroParameters["textFromRTE"].ToString();    
Please Sign in or register to post replies

Write your reply to: