umbracoumbraco7

Get List of values Macro Container Umbraco


I have added a Macro Container into my page. Now in the CMS I selected all the Macro's that I wished to be added to the Macro Container field as shown below

enter image description here

Now I'm fairly new in C# and Umbraco I was thinking of retrieving the value using the below code

foreach (var m in node.GetPropertyValue<IEnumerable<Object>>("macro")) {
     var n = m;
}

Now I thought it will display in an Array or List form but somehow I got a string of all the content of the Macro's I added

enter image description here

Any idea on how to retrieve those in a list? I'm thinking of looping through all those item to be displayed in my cshtml file. Really appreciate your help on this one.

Update: This is the component of the Macro I used

enter image description here enter image description here

Update V2: enter image description here

The approach I was using was to specify the actual name of the Macro. Like @Umbraco.RenderMacro("StockistStoreLocatorPartial") but what I want is more dynamic like what if the name of the macro comes from the list


Solution

  • can you share your document type with us? Or what is the data type of this "Macro"?

    Besides, I wonder if this would fit what you need.