Copied to clipboard

Flag this post as spam?

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


  • CodeMaster2008 151 posts 184 karma points
    Jun 10, 2010 @ 10:00
    CodeMaster2008
    0

    Can't get dictionary values from codebehind - datatype

    Once again I'm working until 3:50 AM and I'm probably too tired to find out what's going on.
    I'm creating a datatype based on a user control as I already did many times.

    The diference this time is that I want to pupulate a dropdownlist using dictionary values.

    On the backend i went to "Settings/Dictionary" and created the keys.
    On the code behind I'm trying to pull the value using the GetDictionaryItem() function and it's always returning an empty string:

    SettingsDropDownList.Items.Add(New ListItem(umbraco.library.GetDictionaryItem("Use Default"), SettingsType.DefaultSettings, True))

    I'm pretty sure I already did something similar when creating a usercontrol for a macro and I was expecting the same to work inside a datatype (usercontrol).

    What exactly am I missing here?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jun 10, 2010 @ 10:16
    Dirk De Grave
    0

    Do you have a language in the language tree that corresponds to the 

    System.Threading.Thread.CurrentThread.CurrentUICulture.Name

     

    Cheers,

    /Dirk

  • Richard Soeteman 3875 posts 12037 karma points MVP
    Jun 10, 2010 @ 10:31
    Richard Soeteman
    0

    I think/ know for sure this is because the Umbraco language file is using en-gb as a culture. To solve this open the file  /umbraco/config/lang/en.xml

    Change the following culture="en-GB", must be culture="en-US"

    Save the file restart IIS and your dictionary items will be translated.

    Cheers,,

    Richard

  • CodeMaster2008 151 posts 184 karma points
    Jun 10, 2010 @ 10:48
    CodeMaster2008
    0

    Well, as i said before I'm using the same approach on different usercontrols and they are working just fine. The difference is that the other usercontrols are being used as macros, not datatypes.

    Based on your question, i took a closer look and here is what i found:

    I didn't add another language to umbraco, I'm using the default wich is "English (United States)".
    My whole system is in English. I double checked my browser just to make sure and it's default (and only language) is English (United States) - [en-US].

    So, I believe it's supposed to be working as it does under the macros however, I don't understand why but at runtime the value for

    System.Threading.Thread.CurrentThread.CurrentUICulture.Name

    is en-GB instead of en-US. Where is it coming from?

  • CodeMaster2008 151 posts 184 karma points
    Jun 10, 2010 @ 10:53
    CodeMaster2008
    0

    @Richard, I think you got it. You test in a few hours. Need some sleep now, it's almost 5AM.

  • CodeMaster2008 151 posts 184 karma points
    Jun 10, 2010 @ 10:54
    CodeMaster2008
    0

    * i meant: I will test it in a few hours...

  • 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