How to get list of all countries and bind to a dropdown list in ASP.NET
Create an ASP.NET application and add a DropDownList to the page something like this.
- <asp:DropDownList ID="ddlCountry" runat="server"></asp:DropDownList>
Now call this GetCountryList method on your page load that will bind and display countries in the DropDownList.
- public List<string> GetCountryList()
- {
- List<string> list = new List<string>();
- CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures |
- CultureTypes.SpecificCultures);
- foreach (CultureInfo info in cultures)
- {
- RegionInfo info2 = new RegionInfo(info.LCID);
- if (!list.Contains(info2.EnglishName))
- {
- list.Add(info2.EnglishName);
- }
- }
- return list;
- }
- ddlLocation.DataSource = GetCountryList();
- ddlLocation.DataBind();
- ddlLocation.Items.Insert(0, "Select");
Note: Updated attachement contains code for orderby the list using LINQ.

Feros KhanPosted Mar 2, 2016, 12:52 AM
both codes are returning same country list
pulkitPosted Aug 28, 2012, 11:20 AM
If any problem plz contact me--my id is [email protected]
pulkiteditedPosted Aug 28, 2012, 3:30 AMEdited Aug 28, 2012, 11:20 AM
HEY USE THIS CODE LINE RegionInfo info2= new Regioninfo(info.name);
Manish KumarPosted Jul 4, 2012, 2:51 AM
Hi, How to get the corresponding states & cities in another dropdown controls. Manish