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

Dictionary(); Sort before.

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

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

                Dictionary<string, string> countryList = new Dictionary<string, string>();

                try
                {

                    foreach (var country in countries)
                    {

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


                    _ddlCountry.DataTextField = "Key";
                    _ddlCountry.DataValueField = "Value";
                    _ddlCountry.DataSource = countryList;
                    _ddlCountry.DataBind();

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

                }
                catch (Exception ex)

                { }

            }
        }
 
Sort before.


Viewing all articles
Browse latest Browse all 23244

Latest Images

Trending Articles



Latest Images

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