aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Bind All Countries to Dropdownlist in using System.Globalization in C#, VB.NET

Aug 4, 2015

Here I will explain how to bind all countries to dropdownlist in using c#, with example or get all countries or display countries in dropdownlist in using c#, By using System.Globalization namespace we can get all countries list in using c#,

In previous articles I explained Angularjs get dropdownlist selected value & text, display gridview based on dropdownlist selection in, bind dropdownlist in gridview in,
gridview examples in and many articles relating to dropdownlist, gridview,, c#, and jQuery. Now I will explain how to bind all countries to dropdownlist in using c#, with example.

To get all countries in first open your aspx page and write the following code

<html xmlns="">
<head runat="server">
<title>binding all countries to dropdownlist in</title>
<form id="form1" runat="server">
<b>Select Country:</b><asp:DropDownList ID="ddlCountries" runat="server"/>

Now add following namespaces in code behind

C# Code

using System;
using System.Web;
using System.Globalization;
using System.Collections.Generic;
using System.Web.UI.WebControls;

After completion of adding namespaces you need to write the code like as shown below

protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
List<string> objcountries = new List<string>();
CultureInfo[] objculture = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
foreach (CultureInfo getculture in objculture)
RegionInfo objregion = new RegionInfo(getculture.LCID);
if (!(objcountries.Contains(objregion.EnglishName)))
ddlCountries.DataSource = objcountries;


Imports System.Web
Imports System.Globalization
Imports System.Collections.Generic
Imports System.Web.UI.WebControls
Partial Class VBCode
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim objcountries As New List(Of String)()
Dim objculture As CultureInfo() = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
For Each getculture As CultureInfo In objculture
Dim objregion As New RegionInfo(getculture.LCID)
If Not (objcountries.Contains(objregion.EnglishName)) Then
End If
ddlCountries.DataSource = objcountries
End If
End Sub
End Class


Bind All Countries to Dropdownlist in using System.Globalization in C#, VB.NET
Download Sample Code Attached

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Unknown said...

Nice sir

Unknown said...

Thanks for this post.
It is really informative one. Get law essay writing service help.

Anonymous said...

Why it doesn't include 'Myanmar' ?

Anonymous said...

Excellent work. I was finding the same in different sites , but yours only fulfilled my requirement.

Unknown said...

Could anyone tell how to store the selected country in MS Sql server?

Unknown said...

hello can anyone tell me the code in above code to show select as first option in list item not a country name as first list item.

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.