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 all,
I'm trying to pass a value to a macro, for example:<umbraco:Macro Alias="TestMacro" PassedValue="test12345" runat="server"></umbraco:Macro>
And then I am trying to retrieve it, without luck. I've tried a few different things:
@Parameters.PassedValue@Model.Parameters.PassedValue...and a few others.
What is the correct way to get the value?
Thanks
Hey Adam,
Welcome to the forum!
I believe it's:
var id = Parameter.PassedValue;
http://our.umbraco.org/documentation/Reference/Templating/Macros/Razor/using-macro-parameters
Rich
Thanks Rich, it was the paramters tab of the macro which I was missing out. Thought I could do it all programatically.
Got it working now, thanks!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to pass parameters to Razor macro?
Hi all,
I'm trying to pass a value to a macro, for example:
<umbraco:Macro Alias="TestMacro" PassedValue="test12345" runat="server"></umbraco:Macro>
And then I am trying to retrieve it, without luck. I've tried a few different things:
@Parameters.PassedValue
@Model.Parameters.PassedValue
...and a few others.
What is the correct way to get the value?
Thanks
Hey Adam,
Welcome to the forum!
I believe it's:
http://our.umbraco.org/documentation/Reference/Templating/Macros/Razor/using-macro-parameters
Rich
Thanks Rich, it was the paramters tab of the macro which I was missing out. Thought I could do it all programatically.
Got it working now, thanks!
is working on a reply...