Copied to clipboard

Flag this post as spam?

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


  • ramzdam 6 posts 27 karma points
    May 19, 2021 @ 15:56
    ramzdam
    0

    Macro Container value as list

    I'm fairly new in Umbraco and C#. Now I have added a Macro Container into my CMS Page and selected the needed partial macro that I will be using for my page. As shown below enter image description here

    In the image above I have StockistStoreLocatorPartial and MailChimpSignup. Now I want to retrieve this names in my controller so that I can display it in my view. So in my controller I tried this

    var macro = node.GetPropertyValue("macro");
    

    but when I debug the value I got this

    enter image description here

    Somehow it's displaying it into a string. I was thinking of displaying it as list. But I don't know how to do that. I'm thinking if I can retrieve it as an Array list of names I can do something like this in my view

    @foreach(var macroName in macroNames)
    {
        @Umbraco.RenderMacro(macroName)
    }
    

    Would really appreciate your help on this. I'm using Umbraco 7.4.1

Please Sign in or register to post replies

Write your reply to:

Draft