0

can anyone tell me how to fill a aspxcombobox with a list of countries in swedish?

I have manage to do this with an english list of countries.

my code:

public static List<string> getCountryList()
{
    List<string> cultureList = new List<string>();
    CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
    foreach (CultureInfo culture in cultures)
    {
        if (culture.LCID != 127 && (culture.CultureTypes & CultureTypes.NeutralCultures) != CultureTypes.NeutralCultures)
        {
            RegionInfo region = new RegionInfo(culture.LCID);
            if (!(cultureList.Contains(region.EnglishName)))
            {
                cultureList.Add(region.EnglishName);
            }
        }
    }
    cultureList.Sort();
    return cultureList;
}

In the config file I have set the following line:

<globalization uiCulture="sv" culture="sv-SE" />

thank you.

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
  • Note that i've added devexpress tag since i assume that `aspxcombobox` is [this control](https://documentation.devexpress.com/#AspNet/clsDevExpressWebASPxEditorsASPxComboBoxtopic). – Tim Schmelter Oct 15 '14 at 09:47

2 Answers2

0

From:ASPxComboBox - How to localize individual item text

ASPxComboBox does not allow one to localize Item's Text declaratively. It is recommended to implement the localization procedure as you already do it (or implement the localization at the datasource level, for example, by introducing some service column that contains translated text entries).

To localize combobox items that are created declaratively, or at runtime, you can use ASP.NET localization: Resources and Localization in ASP.NET 2.0. Localized strings can be gotten from resources.

References:
ASPxComboBox as a "google" type search box

Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75
0

You need to use the RegionInfo's NativeName property. In this case, the editor will be filled using Swedish names of regions.

platon
  • 5,310
  • 1
  • 22
  • 24