Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Need to populate dropdownlist with List Collection.

$
0
0
public void LoadCountries()
        {
            using (GeoNamesClient client = new GeoNamesClient())
            {

                var countries = client.GetCountries("it", GeoStyle.Full);


                List<GeoCountry> countryList = new List<GeoCountry>();
                try
                {

                    foreach (var country in countries)
                    {

                        string strID = country.CountryCode;
                        string strName = country.CountryName;
                       ???// ?.Add(strName, strID);
                    }

                }
                _ddlCountry.DataTextField = "Country";
                _ddlCountry.DataValueField = "CountryCode";
                _ddlCountry.DataSource = ?;
                _ddlCountry.DataBind();

                // Insert the first item.
                _ddlCountry.Items.Insert(0, new RadComboBoxItem("- Select your country -"));


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>