Copied to clipboard

Flag this post as spam?

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


  • Robin Hansen 135 posts 368 karma points
    Jul 17, 2012 @ 17:48
    Robin Hansen
    0

    Render macro through RTE keeps failing

    I'm trying to render a contactform from my webpage on my mobile page - I've triede several examples found on google - but no luck so far... :-|

    I can easily render any content from the RTE(bodyText) but CANNOT render a macro...

    If I runs the @Html.Raw(item.bodyText.ToString()) property (or just plain @item.bodyText) I simply gets the macro tag: "<!--?UMBRACO_MACRO macroAlias="ContactForm" /-->"

    If I runs the @umbraco.library.RenderMacroContent(item.GetProperty("bodyText").Value, item.Id) I gets this error: Error generating macroContent: 'System.Web.HttpException (0x80004005): HtmlForm cannot render without a reference to the Page instance. Make sure your form has been added to the control tree

    A simple <umbraco:Item field="bodyText" runat="server" /> renders the macro the same macro on another page

     

    @{var pathId = @Request.QueryString["id"];}           
    @foreach(var item in Model.NodeById(pathId).Descendants().Where("Visible"))
    {
    if(item.NodeTypeAlias=="Column1")
    {
    <div>
    <div><h1>@item.Name</h1></div>
    <div>
    @*Html.Raw(item.bodyText)*@
    @Html.Raw(item.bodyText.ToString())
    @*Html.Raw(item.GetProperty("bodyText").ToString())*@
    @*umbraco.library.RenderMacroContent(item.GetProperty("bodyText").Value, item.Id)*@
    </div>
    </div>
    }
    }
  • Henri Toivonen 77 posts 111 karma points
    Jul 19, 2012 @ 15:11
    Henri Toivonen
    0

    try changing item.Id into Model.Id

  • Robin Hansen 135 posts 368 karma points
    Jul 20, 2012 @ 15:06
    Robin Hansen
    0

    Like this? @umbraco.library.RenderMacroContent(item.GetProperty("bodyText").Value, Model.Id) ? - allready tried that with no luck either... ~:]

Please Sign in or register to post replies

Write your reply to:

Draft