Copied to clipboard

Flag this post as spam?

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


  • yann 13 posts 32 karma points
    Feb 28, 2012 @ 08:22
    yann
    0

    Getting Macro parameter in razor when macro has been called programatically

    Hi there

    I need to add some macro(.net usercontrols) programatically using a repeater... So I am doing the following in my .Net control:


    int ProductFolderID = 1188;
    umbraco.presentation.templateControls.Macro mcr = new umbraco.presentation.templateControls.Macro();
    mcr.Alias="SiteDocumentULList";
    mcr.MacroAttributes.Add("source",ProductFolderID);
    mcr.MacroAttributes.Add("documenttypealias", "1079");
    this.macroContainer.Controls.Add(mcr);

    I am passing 2 attributes along with my macro...

    however when retrieving the parameter in razor give me nothing:
        // Get parameter from umbraco
        var pageID = @Parameter.source;
        var docTypeAlias= @Parameter.documenttypealias;

    both are empty...

    Is there a way of doing that...

    Thanks for any help

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft