Copied to clipboard

Flag this post as spam?

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


  • Tim C 161 posts 528 karma points
    Jun 25, 2016 @ 06:44
    Tim C
    0

    Read dictionary item in Razor

    I've not used the Dictionary items in settings before, so I created one 'TimTest' and tried to access it in a template eg

    I tried

    @Dictionary.TimTest
    

    and

    @Dictionary["TimTest"]
    

    both returned the error

    Using the generic type 'System.Collections.Generic.Dictionary<TKey,TValue>' requires 2 type arguments
    

    which is confusing : I can't supply TValue as that's what I am trying to retrieve.

    Can anyone help?

    Thanks

  • Tim C 161 posts 528 karma points
    Jun 25, 2016 @ 06:54
    Tim C
    100

    Solved it

    @Umbraco.GetDictionaryValue("TimTest")

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies