Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 13, 2012 @ 11:32
    Ismail Mayat
    0

    Razor dictionary in usercontrol

    Hello,

    In a razor macro you can do Dictionary.Blah. What i want to do is use the dynamic dictionary object in a usercontrol so i dont have to keep doing umbraco.library.GetDictionaryItem("blah"). Is it possible to do this if it is then how.

    Many thanks

     

    Ismail

  • Rodion Novoselov 694 posts 859 karma points
    Mar 13, 2012 @ 13:36
    Rodion Novoselov
    1

    Hi. I think you can use a raw CultureDictionary object (in the umbraco.MacroEngines namespace) like this:

    private CultureDictionary cultureDictionary;

    protected dynamic Dictionary
    {
       get {
          cultureDictionary = cultureDictionary ?? new CultureDictionary();
          return cultureDuctionary;
       }

     

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Mar 13, 2012 @ 15:31
    Ismail Mayat
    0

    Rodion,

    Many thanks just a slight tweak to the code :

     

     private UmbracoCultureDictionary cultureDictionary;

     

            protected dynamic Dictionary

            {

                get

                {

                    cultureDictionary = cultureDictionary ?? new UmbracoCultureDictionary();

                    return cultureDictionary;

                   

                }

            } 

     

    Regards

     

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft