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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...