Copied to clipboard

Flag this post as spam?

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


  • Michael McAiney 14 posts 33 karma points
    Jan 23, 2011 @ 20:38
    Michael McAiney
    0

    Passing Item to .Net Macro inside Template

    Hi all

     

    Hopefully a simple one for you guys to answer...

    I need to pass a Item value to my .Net macro inside my template.  My code below dosen't work.  What is the correct approach ?

    Thanks for any help!

     

        <umbraco:Macro 
                        itemName=<umbraco:Item field="courseVenue" runat="server"></umbraco:Item>
                        Alias="MyControl" runat="server"></umbraco:Macro>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 23, 2011 @ 20:42
    Jan Skovgaard
    0

    Hi Michael

    I don't think you're able to pass values to a macro using umbraco:item.

    I think what you need to do is add the itemName parameter on the macro as a "content picker" type where you can select a node from the tree and do some magic with the returned id in your user control.

    Hope this help.

    /Jan

  • Jonas Eriksson 930 posts 1825 karma points
    Jan 23, 2011 @ 20:48
    Jonas Eriksson
    2

    Hi!

    It should be possible, using the following syntax (sample from wiki-page http://our.umbraco.org/wiki/reference/templates/umbracomacro-element/macro-parameters/advanced-macro-parameter-syntax )

    <umbraco:macro alias="RenderProperties" pagevalue="[#bodyText]" runat="server"/>

    Regards

    Jonas

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 23, 2011 @ 20:49
    Jan Skovgaard
    0

    D'oh! How could I forget that...

    Thanks Jonas :-)

    /Jan

  • Michael McAiney 14 posts 33 karma points
    Jan 23, 2011 @ 21:14
    Michael McAiney
    0

    Thank you :D

  • Rudi Moritz 8 posts 28 karma points
    Aug 03, 2011 @ 23:39
    Rudi Moritz
    0

    Thank you, Michael, for asking what I asked myself.

    And thanks heaps, Jonas, for your simple and perfect answer :)

    Rudi

Please Sign in or register to post replies

Write your reply to:

Draft