Copied to clipboard

Flag this post as spam?

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


  • zedna 7 posts 87 karma points
    Sep 22, 2015 @ 15:18
    zedna
    0

    Get all properties of node

    Hi,

    how can i get all generic properties of node? I have node with name Workplace with tab Filters alias and here are properties Filter A, Filter B, Filter C...

    Can i somehow get all of there properties and their values?

    something like @CurrentPage.GetAllProperties() => ("name", "value")

    Thanks

    Radek

  • Nathan Skidmore 63 posts 251 karma points c-trib
    Sep 23, 2015 @ 09:46
    Nathan Skidmore
    103

    If I'm understanding your question correctly I think something like this is what you're after:

    foreach (var prop in Model.Content.Properties)
    {
        /* get each property value */
        var value = prop.Value;
    }
    
  • zedna 7 posts 87 karma points
    Sep 23, 2015 @ 14:04
    zedna
    0

    Thanks Nathan, yes this gives me all properties of node, but now i have another issue.

    If have properties in this node, and i´m getting here subnodes from another node:

            //get all nodes with correct document type
            var list = CurrentPage.AncestorOrSelf(1).Descendants("Product");
    
            foreach (var item in list)
            {
                <li>
                        <a href="@item.Url">@item.Name</a>
                    </li>
                }
    

    But i need to get all properties of these subnodes to be able to compare them to filter them.

    EDIT: Got it, just inserted another foreach with item.Properties

Please Sign in or register to post replies

Write your reply to:

Draft