Copied to clipboard

Flag this post as spam?

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


  • Andrew Burgess 14 posts 73 karma points
    Dec 23, 2015 @ 13:54
    Andrew Burgess
    0

    mcr.MacroAttributes.Add Not working (Web Forms user control).

    I'm currently trying to render a macro from within a user control, with the ability to dynamically pass in attributes, but I can't for the life of me get the thing to work. I can get the macro to render but can't get any of the attributes to work.

    This is what I have so far -

    umbraco.presentation.templateControls.Macro mcr = new umbraco.presentation.templateControls.Macro();
    mcr.Alias = "BookingSystemSelectSlotTypes";
    mcr.MacroAttributes.Add("SlotTypeGroupMappings", "84,184");
    macroContainer.Controls.Add(mcr);
    

    I've tried a few things outlined in other posts, such as making the macro attribute lowercase (slottypegroupmappings), using mdr.Attributes.Add, and have placed the code in the OnPreRender, PageLoad and PageInit, but haven't been able to get the attributes working.

    Anyone have any ideas?

Please Sign in or register to post replies

Write your reply to:

Draft