But it doesn't work.. gives me this error message:
When this works I would also like to pass Parameters from the PartialView to the Macro. Let's say I would want to pass @CurrentPage.images to the macro parameter called "images". Which I would then get in the Macro with Model.MacroParameters["images"]
Thanks for helping!
EDIT:
this is my umbraco version:
Umbraco version 7.2.1 assembly: 1.0.5462.37503
You said that you are passing a parameter to the parial view, then I think you are working with a parial view maraco. For call this you need to do it like this.
Yes we are a friendly community with some nice people that are trying to help each other : -). Happy to hear that you solve this. - Remember to mark the topic as solved so others can go straight to the solution if they come across the same issue. You do this by clicking the little green tick on the post that give you the solution to your question / problem.
Render a Macro Partial View in a Partial View
Hello, I try to render a Macro Partial View from within a Partial View like so:
But it doesn't work.. gives me this error message:
When this works I would also like to pass Parameters from the PartialView to the Macro. Let's say I would want to pass @CurrentPage.images to the macro parameter called "images". Which I would then get in the Macro with Model.MacroParameters["images"]
Thanks for helping!
EDIT: this is my umbraco version: Umbraco version 7.2.1 assembly: 1.0.5462.37503
Hi TempleClause,
I think you should called the partial view like this
Try to see this documentation https://our.umbraco.org/documentation/Reference/Mvc/partial-views
You said that you are passing a parameter to the parial view, then I think you are working with a parial view maraco. For call this you need to do it like this.
The documentation for the parial view macros can you find here: https://our.umbraco.org/documentation/Reference/Templating/Macros/Partial-View-Macros/
Hope this helps,
/Dennis
Yes exactly, was looking for
@Umbraco.RenderMacro("Divider")
Just need to be able to pass the parameters. I see this definition:
So i did this:
And tried to read the "test" parameter like this:
@Model.MacroParameters["test"]
but now it get the error message: Error loading Partial View script (file: ~/Views/MacroPartials/Divider.cshtml)
By the way, is there a way to turn on error messsages? So I would see why this Partial View gets an error?
Thanks for the help
EDIT: solution is in next post
Figured it out myself! I forgot to define the parameter in the Umbraco Backend under Devolper/Macros
Thanks for helping. Looks like you really are the friendliest community ;-)
Hi TempleClause,
Yes we are a friendly community with some nice people that are trying to help each other : -). Happy to hear that you solve this. - Remember to mark the topic as solved so others can go straight to the solution if they come across the same issue. You do this by clicking the little green tick on the post that give you the solution to your question / problem.
Happy Umbraco coding.
/Dennis
is working on a reply...