Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adam K Dean 7 posts 41 karma points
    Apr 16, 2013 @ 13:12
    Adam K Dean
    0

    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

  • Rich Green 2246 posts 4008 karma points
    Apr 16, 2013 @ 13:21
    Rich Green
    0

    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

  • Adam K Dean 7 posts 41 karma points
    Apr 16, 2013 @ 14:34
    Adam K Dean
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft