Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Nov 25, 2011 @ 04:28
    Tom
    0

    using razor inside a user control macro?

    can you use razor in a user control macro?

    I wanted to get access to some properties etc

     

    Cheers,

    Tom

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Nov 25, 2011 @ 17:33
    Dan Diplo
    2

    You can't use razor syntax but you can get acess to a DynamicNode instance, which is equivalent to your "Model" from which you can access your page properties:

    dynamic model = new umbraco.MacroEngines.DynamicNode(umbraco.NodeFactory.Node.GetCurrent());
    string name = model.Name;

     

  • Tom 713 posts 954 karma points
    Nov 27, 2011 @ 23:32
    Tom
    0

    Thanks Dan! just what I was looking for! :)

Please Sign in or register to post replies

Write your reply to:

Draft