Nesting Dictionary items to create lists

Storing and reading nested Dictionary items as lists in Umbraco using API

  • Share

Recently I wrote an article about workaround for storing lists in Umbraco. I did some googling and Umbraco API exploring since then I found another solution for lists in Umbraco.

This solution is relying to Umbraco Dictionary. As dictionary items allow child elements, you can organize your lists as a list of children of a parent dictionary key. It is a good practice anyway to keep dictionary item grouped one into each other for the better organization into logical areas (check article mentioned in related links on this page).

Nested Dictionary

    private IEnumerable<IDictionaryItem> GetInnerDictionaryItems(string ParentDictionaryKey)
        Umbraco.Core.Services.ILocalizationService localizationService = ApplicationContext.Services.LocalizationService;
        IDictionaryItem parentItem = localizationService.GetDictionaryItemByKey(ParentDictionaryKey);
        if (parentItem != null)
            return localizationService.GetDictionaryItemChildren(parentItem.Key);
        return null;

This approach is better than one mention in the beginning but it also has one big disadvantage. It can only list stings, not value pair as in mentioned article which uses XML to store lists and text and value fro each list item.


There is a bug related to LocalizationService and Dictinary items listing in Umbraco versions 6.0.4, 6.1.4, 6.1.5 and it is fixed starting from 6.2.2

More about mentioned issues for older Umbraco versions check here


  • Share


Purpose of the code contained in snippets or available for download in this article is solely for learning and demo purposes. Author will not be held responsible for any failure or damages caused due to any other usage.

Comments for this article

comments powered by Disqus