Could someone either show me a an example or a tutorial that shows a dropdownlist of countries and their codes
my code shows the wrong language codes for New Zealand it displays mi-NZ instead of en-NZ
ASP.NET
protected void Page_Load(object sender, EventArgs e) {
SortedDictionary<string, string> objDic =
new SortedDictionary<string, string>();
foreach (CultureInfo ObjectCultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
RegionInfo objRegionInfo = new RegionInfo(ObjectCultureInfo.Name);
if(!objDic.ContainsKey(objRegionInfo.EnglishName)) {
objDic.Add(objRegionInfo.EnglishName, ObjectCultureInfo.Name);
}
}
foreach (KeyValuePair<string, string> val in objDic)
{
ddlCountries.Items.Add(new ListItem(val.Key, val.Value));
}
}
e.g
United States(en-US)
New Zealand(en-NZ)
China(zh-CN)
You are excluding
RegionInfo.EnglishName, remove the!and tryCultureTypes.AllCultures: