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?
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.
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.
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
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
But what if I have multiple items with same name. Ie: "CreateUser > UsernameLabel" and "LoginUser > UsernameLabel"?
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
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!
is working on a reply...