Copied to clipboard

Flag this post as spam?

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


  • Daniel 44 posts 187 karma points
    Jan 24, 2014 @ 17:28
    Daniel
    0

    List name and value of all properties

    I would like to list all generic properties of the current document and get the name and value of each. So far I've got this:

            foreach (var property in Model.Content.Properties)
            {
                <p>@property.Value</p>
            }

    On the property object I can also get the alias though PropertyTypeAlias, but how do I get the name atribute?

    Thanks,
    Daniel

  • Mike Chambers 635 posts 1252 karma points c-trib
    Jan 24, 2014 @ 22:19
    Mike Chambers
    100

    Possibly using....

    umbraco.library.GetPropertyTypeName(String ContentTypeAlias, String PropertyTypeAlias)
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 25, 2014 @ 11:39
    Fuji Kusaka
    0

    Daniel

    How about making use of

     @property.Alias

    or

        var node = umbraco.NodeFactory.Node.GetCurrent();

        foreach(Property property  in node.Properties){
              <p>@property.Alias <br/> @property.Value</p>

        }

     

     

  • Daniel 44 posts 187 karma points
    Jan 27, 2014 @ 10:52
    Daniel
    0

    Thanks Mike! That worked! 

    Fuji, Alias is unfortunately not good enough since I want to display it for the end user. BTW the commande to get the alias seems to be property.PropertyTypeAlias.

    /Daniel

Please Sign in or register to post replies

Write your reply to:

Draft