I used this code to populate my dropdownlist with countries list:
public JsonResult GetAllCountries()
{
    var objDict = new Dictionary<string, string>();
    foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
    {
        var regionInfo = new RegionInfo(cultureInfo.Name);
        if (!objDict.ContainsKey(regionInfo.EnglishName))
        {
            objDict.Add(cultureInfo.EnglishName, regionInfo.TwoLetterISORegionName.ToLower());
        }
    }
    var obj = objDict.OrderBy(p => p.Key).ToArray();
    return Json(obj.Select(t => new 
    { 
        Text = t.Key, 
        Value = t.Value 
    }), JsonRequestBehavior.AllowGet);
}
It populates This Way. And I used same code but Console, and shows differently Here. Why? And what should I do to populate the dropdownlist like the second one?
There are 195 countries in the world today. This total comprises 193 countries that are member states of the United Nations and 2 countries that are non-member observer states: the Holy See and the State of Palestine.
A Country Code is a 2-character code that specifies a country. HTML uses 5-character ISO codes according to this pattern: ll-CC. The ll = lower-case language code, and the CC = upper-case country code.
The line
objDic.Add(cultureInfo.EnglishName, regionInfo.TwoLetterISORegionName.ToLower());
Should read
objDic.Add(regionInfo.EnglishName, regionInfo.TwoLetterISORegionName.ToLower());
This will have the website output the same as the console app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With