Copied to clipboard

Flag this post as spam?

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


  • Chris Vickers 4 posts 80 karma points
    Sep 18, 2014 @ 10:07
    Chris Vickers
    0

    Get all Generic Properties

    I've been using Umbraco now for a bit and now need to make a function that will look through all of the generic properties and display all of the values. This is being used for a search and replace within a rich text edtior.

    Can anyone help with this?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 18, 2014 @ 10:15
    Jeavon Leopold
    1

    Hi Chris,

    By generic properties, do you mean Id, Name, CreateDate or your own properties?

    For the latter you can do something like this:

    @foreach (var prop in Model.Content.Properties)
    {
        <li>@prop.PropertyTypeAlias</li>
    }
    

    Jeavon

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Sep 18, 2014 @ 10:22
    Jeavon Leopold
    0

    For the former you can do something like this:

    @foreach (var prop in Model.Content.GetType().GetProperties())
    {
        <li>@prop.Name</li>
    }
    
  • Chris Vickers 4 posts 80 karma points
    Sep 18, 2014 @ 16:00
    Chris Vickers
    100

    Hi There, Thanks for this

    I only need to get the Generic property.

    http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/properties/documentation

    I need all of these. So i can look through and replace within rich text field.

Please Sign in or register to post replies

Write your reply to:

Draft