Copied to clipboard

Flag this post as spam?

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


  • Andreas Gehrke 20 posts 44 karma points
    Jan 26, 2012 @ 14:30
    Andreas Gehrke
    0

    Accessing nested dictionary items in a razor file

    Hello

    How can I access nested dictionary items from a razor file? I know I can use the dynamic @Dictionary.ItemName for non-nested item. Is there a similar syntax for nested items?

    Best regards,
    Andreas

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 26, 2012 @ 14:51
    Jeroen Breuer
    0

    I think nested dictionary items should work the same. For example you have a dictionary itemlevel2 which inherits from itemlevel1. If you want to use it in Razor can't you just do @Dictionary.itemlevel2? It shouldn't matter that it has a parent.

    Jeroen

  • Andreas Gehrke 20 posts 44 karma points
    Jan 26, 2012 @ 15:16
    Andreas Gehrke
    0

    But what if I have multiple items with same name. Ie: "CreateUser > UsernameLabel" and "LoginUser > UsernameLabel"?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 26, 2012 @ 15:19
    Jeroen Breuer
    0

    Hmm never tried that. You'll probably always get one of those 2 values back. Might be better to make those name unique for example: loginuser.usernamelabel.

    Jeroen

  • Andreas Gehrke 20 posts 44 karma points
    Jan 26, 2012 @ 15:41
    Andreas Gehrke
    0

    Okay, I will do that. I just thought the nested feature was created to eliminate the need for "unique" names.

    Thanks for your help, Jeroen!

Please Sign in or register to post replies

Write your reply to:

Draft