DropDownList box to Binding All Countries

Sabarimahesh
Posted by Sabarimahesh under C# category on | Points: 40 | Views : 1655
Namespaces

using System.Globalization;
using System.Collections.Generic;


protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.DataSource = GetCountry();
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, "--SELECT ONE--");

}
public List<string> GetCountry()
{
List<string> list = new List<string>();
foreach(CultureInfo info in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
RegionInfo inforeg = new RegionInfo(info.LCID);
if (!list.Contains(inforeg.EnglishName))
{
list.Add(inforeg.EnglishName);
list.Sort();
}

}
return list;


}

Comments or Responses

Login to post response