我使用asp.net&创建了一个表单c#with Country下拉字段,为此我使用了绑定国家/地区代码,如下所示
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)))
{
objcountries.Add(objregion.EnglishName);
}
}
objcountries.Sort();
ddlCountries.DataSource = objcountries;
ddlCountries.DataBind();
}
}
但我不明白如何将所选值存储在数据库中。我是否需要为国家/地区创建单独的表格?请解释一下。