Copied to clipboard

Flag this post as spam?

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


  • Amit 6 posts 26 karma points
    Aug 29, 2012 @ 16:40
    Amit
    0

    Multiple macros in a template

    Hi All,

    I am new to Umbraco,
    I am working on a ASCX file, as we all know it can used as a macro in the templates.
    But i want to add multiple macros to a single template referring to the same ASCX.
    Please let me know, can we have any unique property for them...?

    If no

    Then do we have any API to access the alias name to the current macro...?
    which can be used in the corresponding ASCX.cs file.

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 30, 2012 @ 11:28
    Lee Kelleher
    1

    Hi Amit,

    As far as I am aware, there isn't an API call within a Macro to identify itself. (Reflection for Macros - interesting idea though!) :-)

    As for giving a Macro a unique property... you could create a macro parameter and then pass that a unique value?

    <umbraco:Macro runat="server" Alias="Test" UniqueProperty="1234" />
    <umbraco:Macro runat="server" Alias="Test" UniqueProperty="5678" />

    Then in your ASCX, you'd have a public property (called "UniqueProperty" - or whatever) to take that value from the Macro.

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft