Since v4.10 Partial View Macros have been the recommended macros for WebForms templates and Razor Macros are legacy. So you could use either of the snippets from here in a Partial View Macro
Hi Jeavon, I can't seem to access any of the properties in the datatype via razor. Shouldn't just "@item.Caption" return the value in the caption field? The json looks like this:
@Jules I'm using v.7.4.3 and your solution doesn't work, I get Amir's original error. For some reason umbraco is returning the "CurrentPage.listOfLinks" value as a json string, which causes the loop to go char by char.
OK this is really, really strange. The type of the property value changed suddenly from a string to the typed object... magically. I have no idea what caused this behaviour.
Related Links Razor Macro Umbraco 7
Does anyone have any related links razor working with a macro for Umbraco 7?
I unfortunately need to use the macro in the RTE and pass a parameter so can't use MVC, this just keeps throwing erros:
The error I'm getting is "'char' does not contain a definition for 'Value'"
-Amir
Hi Amir,
Since v4.10 Partial View Macros have been the recommended macros for WebForms templates and Razor Macros are legacy. So you could use either of the snippets from here in a Partial View Macro
Jeavon
Hi Jeavon, I can't seem to access any of the properties in the datatype via razor. Shouldn't just "@item.Caption" return the value in the caption field? The json looks like this:
Incase anyone else has this issue:
Even simpler now in Umbraco 7.1.6
Jules
@Jules I'm using v.7.4.3 and your solution doesn't work, I get Amir's original error. For some reason umbraco is returning the "CurrentPage.listOfLinks" value as a json string, which causes the loop to go char by char.
OK this is really, really strange. The type of the property value changed suddenly from a string to the typed object... magically. I have no idea what caused this behaviour.
At the top of the view:
in the html. in my case a loop that writes out
<li></li>
:I am sure there could be some cleanup of the code, but it works....
is working on a reply...