Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jul 08, 2011 @ 13:45
    Ismail Mayat
    0

    Get all properties with property alias contains

    I am trying to get all properties for a document where the alias contains social not sure how to do this in razor so far i have

     

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @
      dynamic node new umbraco.MacroEngines.DynamicNode(1050);
    }
    var props = node.PropertiesAsList.Where("")

     

    any ideas how to do this?

    Regards

    Ismail

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Jul 08, 2011 @ 14:02
    Sebastiaan Janssen
    0

    How about something like this:

    @using umbraco.MacroEngines
    @foreach (DynamicNode item in someNodeCollection)
    {
    foreach (var prop in item.PropertiesAsList.Where(x => x.Alias.Contains("a")))
    {
    @item.Name
    }
    }

    The point being: you need to have the node defined as DynamicNode instead of dynamic.

Please Sign in or register to post replies

Write your reply to:

Draft