private void BindDataCountriesToDDL() { AllCountries.DataSource = GeolocationUtils.GetCountriesData(); AllCountries.DataTextField = "Value"; AllCountries.DataValueField = "Key"; AllCountries.DataBind(); }
private void BindDataCountriesToDDL() { var dictlist = new Dictionary <string, string>(); foreach (string s in GeolocationUtils.GeoCountData.Keys) { dictlist.Add(s, s + " (" + GeolocationUtils.GeoCountData[s] + ")"); } AllCountries.DataSource = dictlist; AllCountries.DataTextField = "Value"; AllCountries.DataValueField = "Key"; AllCountries.DataBind(); }
private void BindDataCountriesToDDL() { var dictlist = GeolocationUtils.GetCountriesData(); if (PageRequest == RequestType.Edit) { var geolocated = new Dictionary <string, string>(); var ad = new PtcAdvert(Convert.ToInt32(ViewState["editid"])); if (ad.IsGeolocatedByCountry) { var countries = ad.GeolocatedCC.Split(','); foreach (var country in countries) { if (string.IsNullOrEmpty(country)) { continue; } var countryName = CountryManager.GetCountryName(country); dictlist.Remove(countryName); var geolocatedCountry = GeolocationUtils.GetCountryData(countryName); geolocated.Add(geolocatedCountry.Item1, geolocatedCountry.Item2); } GeoCountries.DataSource = geolocated; GeoCountries.DataTextField = "Value"; GeoCountries.DataValueField = "Key"; GeoCountries.DataBind(); } } AllCountries.DataSource = dictlist; AllCountries.DataTextField = "Value"; AllCountries.DataValueField = "Key"; AllCountries.DataBind(); }