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 10059 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 4899 posts 14655 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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies