Copied to clipboard

Flag this post as spam?

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


  • Chris C 43 posts 184 karma points
    Jul 18, 2016 @ 19:12
    Chris C
    0

    List of key/value pairs for display on Umbraco pages

    Hi. I'm wondering if there is a recommended or best practices way of storing a list of arbitrary key/value pairs in Umbraco. Using Razor code, I want to look up the values by key and display them on Umbraco pages.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jul 19, 2016 @ 19:01
    Dan Diplo
    100

    I guess it depends on how much data you have. I'm assuming you want it to be editable, right?

    So, for instance, you could just create nodes in Umbraco without a template - these all will have a unique Id and Name property.

    You could also use something like Archetype package which allows you to create repeatable content - so create two fields (key and value).

  • Chris C 43 posts 184 karma points
    Jul 20, 2016 @ 15:41
    Chris C
    0

    Ok, thanks. It will be maybe 20 to 50 items. Sounds like using the node structure with a custom datatype/no template should work.

  • Ian 178 posts 752 karma points
    Jul 20, 2016 @ 16:07
    Ian
    0

    Only my opinion but using nodes seems bad for doing this as you have all the overhead of a full content model for two fields. I would stick to using one of the packages like archetype or nested content. I'm sure it would also be pretty simple to create your own property editor look at this property editor as a guide .. you could pretty much use the prevalue editor in this to rework it as your editor.

  • Ian 178 posts 752 karma points
    Jul 20, 2016 @ 20:45
    Ian
    0

    I decided knock up a quick property editor as i explained, you can see the source here

    I also discovered this package though I preferred to build on the styling and behaviour of the dtp list example

  • Chris C 43 posts 184 karma points
    Jul 21, 2016 @ 15:53
    Chris C
    0

    That's cool. I'm not sure I know how or where to use it though. Will check out the guide you posted for using custom properties.

Please Sign in or register to post replies

Write your reply to:

Draft