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
I have a model class with one property that I need to pass to my macro.
I am rendering my macro on my view as follows:
@Umbraco.RenderMacro("listArticles")
Can anyone tell me how I might be able to pass my model class to my macro?
Thanks
Tom
Hi Tom,
Perhaps you can see this documentation https://our.umbraco.org/documentation/reference/templating/Mvc/views#RenderingMacros on how to render partial view macro with parameters.
Hope this can help you,
/Dennis
Thanks Dennis. How do I pass a model class to my Macro?
Dennis:
This works...@Umbraco.RenderMacro("listArticles", new Mantle2.Models.ArticleTypeModel())
Now on my Mantle2.Models.ArticleTypeModel() class I have one property.How do I set its value to custom field (Category) found on my document type?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to pass a model to a macro
I have a model class with one property that I need to pass to my macro.
I am rendering my macro on my view as follows:
@Umbraco.RenderMacro("listArticles")
Can anyone tell me how I might be able to pass my model class to my macro?
Thanks
Tom
Hi Tom,
Perhaps you can see this documentation https://our.umbraco.org/documentation/reference/templating/Mvc/views#RenderingMacros on how to render partial view macro with parameters.
Hope this can help you,
/Dennis
Thanks Dennis. How do I pass a model class to my Macro?
Tom
Dennis:
This works...
@Umbraco.RenderMacro("listArticles", new Mantle2.Models.ArticleTypeModel())
Now on my Mantle2.Models.ArticleTypeModel() class I have one property.
How do I set its value to custom field (Category) found on my document type?
Thanks
is working on a reply...