Copied to clipboard

Flag this post as spam?

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


  • roei 3 posts 23 karma points
    Oct 24, 2021 @ 11:34
    roei
    0

    macro inside macro -> Cannot render a macro when there is no current PublishedContentRequest.

    I'm trying to put Macro inside another macro, and I get Error message from Umbraco(exactly from the line that I put RenderMacro) :

    An error occured Cannot render a macro when there is no current PublishedContentRequest. Exception Details System.InvalidOperationException: Cannot render a macro when there is no current PublishedContentRequest.

    The question: what I need to do to render macro inside another macro"?

    this is the Imporant parts of code of The CTAMacro that contain RenderMacro that calls "StartPracticingButton":

    @using System.Text.RegularExpressions;
    @using System.Configuration;
    
    @inherits Umbraco.Web.Macros.PartialViewMacroPage
     @{
    string CTATitle = (string)Model.MacroParameters["ctaTitle"];
    string CTAContent = (string)Model.MacroParameters["ctaContent"];
    string CTATestId = (string)Model.MacroParameters["ctaTestId"];
    string fullProductButtonText = "";
    string fullProductSku = "";
       } 
     <div class="ctaFreeTest">
        <div class="cta">
            <div class="ctaTitle">
                @CTATitle
            </div>
            {
              <div class="productPageButtonContainer">
    

    ////////////////////////HERE COME THE RENDERMACRO THAT GIVES THE ERROR:

           @Umbraco.RenderMacro("StartPracticingButton", new 
        ViewDataDictionary { { "nodeid", Model.Content.Id } })
        </div>
            }
    
        </div>
    
    
    </div>
    
Please Sign in or register to post replies

Write your reply to:

Draft