【问题标题】:fill a aspx combobox with a list of countries in swedish?用瑞典语国家列表填充 aspx 组合框?
【发布时间】:2014-10-15 09:46:07
【问题描述】:

谁能告诉我如何用瑞典语国家列表填充 aspxcombobox?

我已经设法使用英文国家列表来做到这一点。

我的代码:

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;
}

在配置文件中我设置了以下行:

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

谢谢。

【问题讨论】:

  • 请注意,我添加了 devexpress 标签,因为我假设 aspxcomboboxthis control

标签: c# asp.net combobox devexpress countries


【解决方案1】:

发件人:ASPxComboBox - How to localize individual item text

ASPxComboBox 不允许以声明方式本地化项目的文本。 建议您执行本地化程序 已经做到了(或在数据源级别实现本地化, 例如,通过引入一些包含 翻译的文本条目)。

要本地化以声明方式或在运行时创建的组合框项,您可以使用 ASP.NET 本地化:Resources and Localization in ASP.NET 2.0。本地化字符串可以从资源中获取。

参考:
ASPxComboBox as a "google" type search box

【讨论】:

    【解决方案2】:

    您需要使用 RegionInfo 的 NativeName 属性。在这种情况下,编辑器将使用瑞典地区名称填充。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多