Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm new to Razor and Umbraco and have a syntax question.
I'm trying to insert an Umbraco field as a macro's parameter, is something like this possible?
Umbraco.RenderMacro("MyMacro", new {MyParam=Umbraco.Field("myField")})
Thanks.
Hi David,
I think you need to access your property using Model.Content.GetPropertyValue method, e.g.
@Umbraco.RenderMacro("MyMacro", new {MyParam = Model.Content.GetPropertyValue<string>("myField")});
Thanks,
Jeavon
Thanks, I ended up creating a partial view instead of a macro.
Cheers.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Dynamic macro parameter syntax, using an Umbraco field as value
Hi,
I'm new to Razor and Umbraco and have a syntax question.
I'm trying to insert an Umbraco field as a macro's parameter, is something like this possible?
Umbraco.RenderMacro("MyMacro", new {MyParam=Umbraco.Field("myField")})
Thanks.
Hi David,
I think you need to access your property using Model.Content.GetPropertyValue method, e.g.
Thanks,
Jeavon
Thanks, I ended up creating a partial view instead of a macro.
Cheers.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.