Background
There is often a need to display a county list. For that many beginners and developers use a database to store the list of countries and they are displayed using a specific control but by using this method there are many server resources used that results in the application becoming slow and it is not be possible to display all the countries of the world exactly.
But by using the Globalization class of C# you can easily do it without any database or without using many server resources, so by considering the above requirement I have written this article for beginners, students and anyone that wants to learn. So let us start from the basics.
The Globalization class
According to MSDN, Globalization is the process of designing and developing a software product that functions in multiple cultures/locales.
This process involves:
- Identifying the culture/locale that must be supported.
- Designing features that support those cultures/locales.
- Writing code that functions equally well in any of the supported cultures/locales.
- using System.Globalization;
I hope you understand some basics about the Globalization class.
Now let us start to create a Website as:
- Open Visual Studio from Start -> All programs -> Microsoft Visual Studio.
- Then go to to "File" -> "New" -> "WebSite..." then select Visual C# -> Web application.
- Then specify the name, CountryList, or any name as you wish and the location of the project and click on the OK button. The new web site is created.
Use the following source code in the default.aspx <body> section page as:
- <body>
- <form id="form1" runat="server">
- <div class="div" align="center">
- <br /> <br />
- <asp:DropDownList ID="DropDownList1" runat="server" Width="100px">
- </asp:DropDownList>
- </div>
- </form>
- </body>
Then switch to view code and create the following method in the default.aspx.cs to get the country list using Globalization:

Now call the preceding method on page load with the dropdonlist to bind the country list as:

In the code above I first ensured that my page is not posted back using the IsPostBack property so the dropdownlist is not be refreshed every page post-back and then I just assigned the country list method to the dropdownlist Data Source property and finally calling the Data Bind method to bind the dropdownlist. You can also bind the preceding list method to any control that supports the Data Source property.
Now run the application and select a Country from the DropDownList that looks as in the following image:

From the preceding example, it's clear that if we undersatnd the .Net Framework deeply then you can reduce our application code more than, or at least, 50 percent and that results in better application performance.

Now call the preceding method on page load with the dropdonlist to bind the country list as:

In the code above I first ensured that my page is not posted back using the IsPostBack property so the dropdownlist is not be refreshed every page post-back and then I just assigned the country list method to the dropdownlist Data Source property and finally calling the Data Bind method to bind the dropdownlist. You can also bind the preceding list method to any control that supports the Data Source property.
Now run the application and select a Country from the DropDownList that looks as in the following image:

From the preceding example, it's clear that if we undersatnd the .Net Framework deeply then you can reduce our application code more than, or at least, 50 percent and that results in better application performance.
Note:
- For detailed code please download the Zip file attached above.
Summary
From all the examples above we see how to reduce the code required to do these tasks. I hope this article is useful for all students and beginners. If you have any suggestion related to this article then please contact me.

Omar MallatPosted Jun 13, 2022, 1:56 PM
Did you notice that this list is not accurate. for example, the GetCulture command return Cyprus with LCID 4096, but when you create the RegionInfo of 4096, it returns Djibouti!!!!
Hasan HabibPosted Jan 10, 2017, 3:17 AM
Did anyone have code for full list of countries not using retrieve from database table?
Vithal WadjePosted Mar 17, 2016, 4:06 AM
refer my other articles
Chioma JoshuaPosted Mar 16, 2016, 11:25 AM
Hello.. Thank You For Sharing... i want to also get a list of states and cities in each country..
Vithal WadjePosted Nov 12, 2014, 9:46 AM
thanks Nattharee Pisarnsathukit
Vithal WadjePosted Nov 12, 2014, 9:44 AM
yes venkat kumar sir,soon i will post article
Venkat KumarPosted Nov 12, 2014, 6:31 AM
Nice.. but i just want to get the state names based on selected Country and then City name based on state.. ?
Vithal WadjePosted Sep 23, 2014, 10:20 AM
thanks sir
Abhijit PatilPosted Sep 23, 2014, 1:59 AM
Great artical sir
Sunny SharmaPosted Sep 22, 2014, 6:40 AM
Nice%20article!%20You're%20getting%20the%20countries%20in%20list%20but%20the%20Globalization%20class%20doesn't%20mean%20to%20provide%20with%20the%20country%20names.%20If%20you%20closely%20count%20the%20items%20in%20drop%20down%20list%20-%20they%20will%20count%20to%20140%20only%2C%20and%20you%20see%20we%20have%20more%20than%20140%20countries%20in%20the%20world.%20Globalization%20class%20provides%20culture%20information%20for%20most%20of%20the%20countries%2C%20not%20all.%20So%2C%20one%20should%20never%20rely%20on%20CultureInfo%20for%20getting%20the%20country%20list%2C%20it%20will%20fail.
Nattharee PisarnsathukitPosted Sep 22, 2014, 5:12 AM
Thank you! Good for using
nivethitha thangavelPosted May 31, 2014, 2:55 AM
very good work sir, and i want to know how to do this for selecting state and city
Vithal WadjePosted Mar 7, 2014, 2:25 PM
sure sir,i will check it
ilaya bharathiPosted Mar 7, 2014, 5:19 AM
sir output is getting but when i try to submit the county in db it default taking Afghanistan even i select the country its taking the 1st value only could you please check it that
ilaya bharathiPosted Mar 7, 2014, 5:00 AM
great but pakistan is missing
Vithal WadjePosted Oct 18, 2013, 2:20 PM
thanks Sahil Sharma sir,i will look and update you soon
Sahil SharmaPosted Oct 18, 2013, 8:22 AM
Very Useful..but there is a strange issue as Pakistan is not showing in the list
Vithal WadjePosted Jul 27, 2013, 2:05 PM
thanks alok
alok ranjanPosted Jul 27, 2013, 11:49 AM
it is superb for my project thanks
Vithal WadjePosted Jul 5, 2013, 2:10 AM
thanks priya
priya talolePosted Jul 4, 2013, 4:51 AM
Its working sir superb artical it is useful for me thank you
Vithal WadjePosted Jul 3, 2013, 10:57 AM
Miracle cant I say yes but I am trying for that,thanks
MiraclePosted Jul 3, 2013, 5:02 AM
is it possible to display city of the country and province?