Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML

Load all the Country Names of the World in DropDown

5.00/5 (6 votes)
2 Apr 2011CPOL 23.8K  
DescriptionT...

Description


This shows how to bind Country names in DropDownList using external data source(XML).

XML


XML
<countries>
    <country countryname="AFGHANISTAN" twoletterisoregionname="AF" threeletterisoregionname="AFG" countrycode="004" />
    <country countryname="ALBANIA" twoletterisoregionname="AL" threeletterisoregionname="ALB" countrycode="008" />
    <country countryname="ALGERIA" twoletterisoregionname="DZ" threeletterisoregionname="DZA" countrycode="012" />
    <country countryname="AMERICAN SAMOA" twoletterisoregionname="AS" threeletterisoregionname="ASM" countrycode="016" />
    <country countryname="ANDORRA" twoletterisoregionname="AD" threeletterisoregionname="AND" countrycode="020" />
    <country countryname="ANGOLA" twoletterisoregionname="AO" threeletterisoregionname="AGO" countrycode="024" />
    <country countryname="ANGUILLA" twoletterisoregionname="AI" threeletterisoregionname="AIA" countrycode="660" />
    <country countryname="ANTARCTICA" twoletterisoregionname="AQ" threeletterisoregionname="ATA" countrycode="010" />
    <country countryname="ANTIGUA AND BARBUDA" twoletterisoregionname="AG" threeletterisoregionname="ATG" countrycode="028" />
    <country countryname="ARGENTINA" twoletterisoregionname="AR" threeletterisoregionname="ARG" countrycode="032" />
    <country countryname="ARMENIA" twoletterisoregionname="AM" threeletterisoregionname="ARM" countrycode="051" />
    <country countryname="ARUBA" twoletterisoregionname="AW" threeletterisoregionname="ABW" countrycode="533" />
    <country countryname="AUSTRALIA" twoletterisoregionname="AU" threeletterisoregionname="AUS" countrycode="036" />
    <country countryname="AUSTRIA" twoletterisoregionname="AT" threeletterisoregionname="AUT" countrycode="040" />
    <country countryname="AZERBAIJAN" twoletterisoregionname="AZ" threeletterisoregionname="AZE" countrycode="031" />
    <country countryname="BAHAMAS" twoletterisoregionname="BS" threeletterisoregionname="BHS" countrycode="044" />
    <country countryname="BAHRAIN" twoletterisoregionname="BH" threeletterisoregionname="BHR" countrycode="048" />
    <country countryname="BANGLADESH" twoletterisoregionname="BD" threeletterisoregionname="BGD" countrycode="050" />
    <country countryname="BARBADOS" twoletterisoregionname="BB" threeletterisoregionname="BRB" countrycode="052" />
    <country countryname="BELARUS" twoletterisoregionname="BY" threeletterisoregionname="BLR" countrycode="112" />
    <country countryname="BELGIUM" twoletterisoregionname="BE" threeletterisoregionname="BEL" countrycode="056" />
    <country countryname="BELIZE" twoletterisoregionname="BZ" threeletterisoregionname="BLZ" countrycode="084" />
    <country countryname="BENIN" twoletterisoregionname="BJ" threeletterisoregionname="BEN" countrycode="204" />
    <country countryname="BERMUDA" twoletterisoregionname="BM" threeletterisoregionname="BMU" countrycode="060" />
    <country countryname="BHUTAN" twoletterisoregionname="BT" threeletterisoregionname="BTN" countrycode="064" />
    <country countryname="BOLIVIA" twoletterisoregionname="BO" threeletterisoregionname="BOL" countrycode="068" />
    <country countryname="BOSNIA AND HERZEGOWINA" twoletterisoregionname="BA" threeletterisoregionname="BIH" countrycode="070" />
    <country countryname="BOTSWANA" twoletterisoregionname="BW" threeletterisoregionname="BWA" countrycode="072" />
    <country countryname="BOUVET ISLAND" twoletterisoregionname="BV" threeletterisoregionname="BVT" countrycode="074" />
    <country countryname="BRAZIL" twoletterisoregionname="BR" threeletterisoregionname="BRA" countrycode="076" />
    <country countryname="BRITISH INDIAN OCEAN TERRITORY" twoletterisoregionname="IO" threeletterisoregionname="IOT" countrycode="086" />
    <country countryname="BRUNEI DARUSSALAM" twoletterisoregionname="BN" threeletterisoregionname="BRN" countrycode="096" />
    <country countryname="BULGARIA" twoletterisoregionname="BG" threeletterisoregionname="BGR" countrycode="100" />
    <country countryname="BURKINA FASO" twoletterisoregionname="BF" threeletterisoregionname="BFA" countrycode="854" />
    <country countryname="BURUNDI" twoletterisoregionname="BI" threeletterisoregionname="BDI" countrycode="108" />
    <country countryname="CAMBODIA" twoletterisoregionname="KH" threeletterisoregionname="KHM" countrycode="116" />
    <country countryname="CAMEROON" twoletterisoregionname="CM" threeletterisoregionname="CMR" countrycode="120" />
    <country countryname="CANADA" twoletterisoregionname="CA" threeletterisoregionname="CAN" countrycode="124" />
    <country countryname="CAPE VERDE" twoletterisoregionname="CV" threeletterisoregionname="CPV" countrycode="132" />
    <country countryname="CAYMAN ISLANDS" twoletterisoregionname="KY" threeletterisoregionname="CYM" countrycode="136" />
    <country countryname="CENTRAL AFRICAN REPUBLIC" twoletterisoregionname="CF" threeletterisoregionname="CAF" countrycode="140" />
    <country countryname="CHAD" twoletterisoregionname="TD" threeletterisoregionname="TCD" countrycode="148" />
    <country countryname="CHILE" twoletterisoregionname="CL" threeletterisoregionname="CHL" countrycode="152" />
    <country countryname="CHINA" twoletterisoregionname="CN" threeletterisoregionname="CHN" countrycode="156" />
    <country countryname="CHRISTMAS ISLAND" twoletterisoregionname="CX" threeletterisoregionname="CXR" countrycode="162" />
    <country countryname="COCOS (KEELING) ISLANDS" twoletterisoregionname="CC" threeletterisoregionname="CCK" countrycode="166" />
    <country countryname="COLOMBIA" twoletterisoregionname="CO" threeletterisoregionname="COL" countrycode="170" />
    <country countryname="COMOROS" twoletterisoregionname="KM" threeletterisoregionname="COM" countrycode="174" />
    <country countryname="CONGO" twoletterisoregionname="CG" threeletterisoregionname="COG" countrycode="178" />
    <country countryname="COOK ISLANDS" twoletterisoregionname="CK" threeletterisoregionname="COK" countrycode="184" />
    <country countryname="COSTA RICA" twoletterisoregionname="CR" threeletterisoregionname="CRI" countrycode="188" />
    <country countryname="COTE D'IVOIRE" twoletterisoregionname="CI" threeletterisoregionname="CIV" countrycode="384" />
    <country countryname="CROATIA (local name: Hrvatska)" twoletterisoregionname="HR" threeletterisoregionname="HRV" countrycode="191" />
    <country countryname="CUBA" twoletterisoregionname="CU" threeletterisoregionname="CUB" countrycode="192" />
    <country countryname="CYPRUS" twoletterisoregionname="CY" threeletterisoregionname="CYP" countrycode="196" />
    <country countryname="CZECH REPUBLIC" twoletterisoregionname="CZ" threeletterisoregionname="CZE" countrycode="203" />
    <country countryname="DENMARK" twoletterisoregionname="DK" threeletterisoregionname="DNK" countrycode="208" />
    <country countryname="DJIBOUTI" twoletterisoregionname="DJ" threeletterisoregionname="DJI" countrycode="262" />
    <country countryname="DOMINICA" twoletterisoregionname="DM" threeletterisoregionname="DMA" countrycode="212" />
    <country countryname="DOMINICAN REPUBLIC" twoletterisoregionname="DO" threeletterisoregionname="DOM" countrycode="214" />
    <country countryname="EAST TIMOR" twoletterisoregionname="TP" threeletterisoregionname="TMP" countrycode="626" />
    <country countryname="ECUADOR" twoletterisoregionname="EC" threeletterisoregionname="ECU" countrycode="218" />
    <country countryname="EGYPT" twoletterisoregionname="EG" threeletterisoregionname="EGY" countrycode="818" />
    <country countryname="EL SALVADOR" twoletterisoregionname="SV" threeletterisoregionname="SLV" countrycode="222" />
    <country countryname="EQUATORIAL GUINEA" twoletterisoregionname="GQ" threeletterisoregionname="GNQ" countrycode="226" />
    <country countryname="ERITREA" twoletterisoregionname="ER" threeletterisoregionname="ERI" countrycode="232" />
    <country countryname="ESTONIA" twoletterisoregionname="EE" threeletterisoregionname="EST" countrycode="233" />
    <country countryname="ETHIOPIA" twoletterisoregionname="ET" threeletterisoregionname="ETH" countrycode="231" />
    <country countryname="FALKLAND ISLANDS (MALVINAS)" twoletterisoregionname="FK" threeletterisoregionname="FLK" countrycode="238" />
    <country countryname="FAROE ISLANDS" twoletterisoregionname="FO" threeletterisoregionname="FRO" countrycode="234" />
    <country countryname="FIJI" twoletterisoregionname="FJ" threeletterisoregionname="FJI" countrycode="242" />
    <country countryname="FINLAND" twoletterisoregionname="FI" threeletterisoregionname="FIN" countrycode="246" />
    <country countryname="FRANCE" twoletterisoregionname="FR" threeletterisoregionname="FRA" countrycode="250" />
    <country countryname="FRANCE, METROPOLITAN" twoletterisoregionname="FX" threeletterisoregionname="FXX" countrycode="249" />
    <country countryname="FRENCH GUIANA" twoletterisoregionname="GF" threeletterisoregionname="GUF" countrycode="254" />
    <country countryname="FRENCH POLYNESIA" twoletterisoregionname="PF" threeletterisoregionname="PYF" countrycode="258" />
    <country countryname="FRENCH SOUTHERN TERRITORIES" twoletterisoregionname="TF" threeletterisoregionname="ATF" countrycode="260" />
    <country countryname="GABON" twoletterisoregionname="GA" threeletterisoregionname="GAB" countrycode="266" />
    <country countryname="GAMBIA" twoletterisoregionname="GM" threeletterisoregionname="GMB" countrycode="270" />
    <country countryname="GEORGIA" twoletterisoregionname="GE" threeletterisoregionname="GEO" countrycode="268" />
    <country countryname="GERMANY" twoletterisoregionname="DE" threeletterisoregionname="DEU" countrycode="276" />
    <country countryname="GHANA" twoletterisoregionname="GH" threeletterisoregionname="GHA" countrycode="288" />
    <country countryname="GIBRALTAR" twoletterisoregionname="GI" threeletterisoregionname="GIB" countrycode="292" />
    <country countryname="GREECE" twoletterisoregionname="GR" threeletterisoregionname="GRC" countrycode="300" />
    <country countryname="GREENLAND" twoletterisoregionname="GL" threeletterisoregionname="GRL" countrycode="304" />
    <country countryname="GRENADA" twoletterisoregionname="GD" threeletterisoregionname="GRD" countrycode="308" />
    <country countryname="GUADELOUPE" twoletterisoregionname="GP" threeletterisoregionname="GLP" countrycode="312" />
    <country countryname="GUAM" twoletterisoregionname="GU" threeletterisoregionname="GUM" countrycode="316" />
    <country countryname="GUATEMALA" twoletterisoregionname="GT" threeletterisoregionname="GTM" countrycode="320" />
    <country countryname="GUINEA" twoletterisoregionname="GN" threeletterisoregionname="GIN" countrycode="324" />
    <country countryname="GUINEA-BISSAU" twoletterisoregionname="GW" threeletterisoregionname="GNB" countrycode="624" />
    <country countryname="GUYANA" twoletterisoregionname="GY" threeletterisoregionname="GUY" countrycode="328" />
    <country countryname="HAITI" twoletterisoregionname="HT" threeletterisoregionname="HTI" countrycode="332" />
    <country countryname="HEARD AND MC DONALD ISLANDS" twoletterisoregionname="HM" threeletterisoregionname="HMD" countrycode="334" />
    <country countryname="HOLY SEE (VATICAN CITY STATE)" twoletterisoregionname="VA" threeletterisoregionname="VAT" countrycode="336" />
    <country countryname="HONDURAS" twoletterisoregionname="HN" threeletterisoregionname="HND" countrycode="340" />
    <country countryname="HONG KONG" twoletterisoregionname="HK" threeletterisoregionname="HKG" countrycode="344" />
    <country countryname="HUNGARY" twoletterisoregionname="HU" threeletterisoregionname="HUN" countrycode="348" />
    <country countryname="ICELAND" twoletterisoregionname="IS" threeletterisoregionname="ISL" countrycode="352" />
    <country countryname="INDIA" twoletterisoregionname="IN" threeletterisoregionname="IND" countrycode="356" />
    <country countryname="INDONESIA" twoletterisoregionname="ID" threeletterisoregionname="IDN" countrycode="360" />
    <country countryname="IRAN (ISLAMIC REPUBLIC OF)" twoletterisoregionname="IR" threeletterisoregionname="IRN" countrycode="364" />
    <country countryname="IRAQ" twoletterisoregionname="IQ" threeletterisoregionname="IRQ" countrycode="368" />
    <country countryname="IRELAND" twoletterisoregionname="IE" threeletterisoregionname="IRL" countrycode="372" />
    <country countryname="ISRAEL" twoletterisoregionname="IL" threeletterisoregionname="ISR" countrycode="376" />
    <country countryname="ITALY" twoletterisoregionname="IT" threeletterisoregionname="ITA" countrycode="380" />
    <country countryname="JAMAICA" twoletterisoregionname="JM" threeletterisoregionname="JAM" countrycode="388" />
    <country countryname="JAPAN" twoletterisoregionname="JP" threeletterisoregionname="JPN" countrycode="392" />
    <country countryname="JORDAN" twoletterisoregionname="JO" threeletterisoregionname="JOR" countrycode="400" />
    <country countryname="KAZAKHSTAN" twoletterisoregionname="KZ" threeletterisoregionname="KAZ" countrycode="398" />
    <country countryname="KENYA" twoletterisoregionname="KE" threeletterisoregionname="KEN" countrycode="404" />
    <country countryname="KIRIBATI" twoletterisoregionname="KI" threeletterisoregionname="KIR" countrycode="296" />
    <country countryname="KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF" twoletterisoregionname="KP" threeletterisoregionname="PRK" countrycode="408" />
    <country countryname="KOREA, REPUBLIC OF" twoletterisoregionname="KR" threeletterisoregionname="KOR" countrycode="410" />
    <country countryname="KUWAIT " twoletterisoregionname="KW" threeletterisoregionname="KWT" countrycode="414" />
    <country countryname="KYRGYZSTAN" twoletterisoregionname="KG" threeletterisoregionname="KGZ" countrycode="417" />
    <country countryname="LAO PEOPLE'S DEMOCRATIC REPUBLIC" twoletterisoregionname="LA" threeletterisoregionname="LAO" countrycode="418" />
    <country countryname="LATVIA" twoletterisoregionname="LV" threeletterisoregionname="LVA" countrycode="428" />
    <country countryname="LEBANON" twoletterisoregionname="LB" threeletterisoregionname="LBN" countrycode="422" />
    <country countryname="LESOTHO" twoletterisoregionname="LS" threeletterisoregionname="LSO" countrycode="426" />
    <country countryname="LIBERIA" twoletterisoregionname="LR" threeletterisoregionname="LBR" countrycode="430" />
    <country countryname="LIBYAN ARAB JAMAHIRIYA" twoletterisoregionname="LY" threeletterisoregionname="LBY" countrycode="434" />
    <country countryname="LIECHTENSTEIN" twoletterisoregionname="LI" threeletterisoregionname="LIE" countrycode="438" />
    <country countryname="LITHUANIA" twoletterisoregionname="LT" threeletterisoregionname="LTU" countrycode="440" />
    <country countryname="LUXEMBOURG" twoletterisoregionname="LU" threeletterisoregionname="LUX" countrycode="442" />
    <country countryname="MACAU" twoletterisoregionname="MO" threeletterisoregionname="MAC" countrycode="446" />
    <country countryname="MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF" twoletterisoregionname="MK" threeletterisoregionname="MKD" countrycode="807" />
    <country countryname="MADAGASCAR" twoletterisoregionname="MG" threeletterisoregionname="MDG" countrycode="450" />
    <country countryname="MALAWI" twoletterisoregionname="MW" threeletterisoregionname="MWI" countrycode="454" />
    <country countryname="MALAYSIA" twoletterisoregionname="MY" threeletterisoregionname="MYS" countrycode="458" />
    <country countryname="MALDIVES" twoletterisoregionname="MV" threeletterisoregionname="MDV" countrycode="462" />
    <country countryname="MALI" twoletterisoregionname="ML" threeletterisoregionname="MLI" countrycode="466" />
    <country countryname="MALTA" twoletterisoregionname="MT" threeletterisoregionname="MLT" countrycode="470" />
    <country countryname="MARSHALL ISLANDS" twoletterisoregionname="MH" threeletterisoregionname="MHL" countrycode="584" />
    <country countryname="MARTINIQUE" twoletterisoregionname="MQ" threeletterisoregionname="MTQ" countrycode="474" />
    <country countryname="MAURITANIA" twoletterisoregionname="MR" threeletterisoregionname="MRT" countrycode="478" />
    <country countryname="MAURITIUS" twoletterisoregionname="MU" threeletterisoregionname="MUS" countrycode="480" />
    <country countryname="MAYOTTE" twoletterisoregionname="YT" threeletterisoregionname="MYT" countrycode="175" />
    <country countryname="MEXICO" twoletterisoregionname="MX" threeletterisoregionname="MEX" countrycode="484" />
    <country countryname="MICRONESIA, FEDERATED STATES OF" twoletterisoregionname="FM" threeletterisoregionname="FSM" countrycode="583" />
    <country countryname="MOLDOVA, REPUBLIC OF" twoletterisoregionname="MD" threeletterisoregionname="MDA" countrycode="498" />
    <country countryname="MONACO" twoletterisoregionname="MC" threeletterisoregionname="MCO" countrycode="492" />
    <country countryname="MONGOLIA" twoletterisoregionname="MN" threeletterisoregionname="MNG" countrycode="496" />
    <country countryname="MONTSERRAT" twoletterisoregionname="MS" threeletterisoregionname="MSR" countrycode="500" />
    <country countryname="MOROCCO" twoletterisoregionname="MA" threeletterisoregionname="MAR" countrycode="504" />
    <country countryname="MOZAMBIQUE" twoletterisoregionname="MZ" threeletterisoregionname="MOZ" countrycode="508" />
    <country countryname="MYANMAR" twoletterisoregionname="MM" threeletterisoregionname="MMR" countrycode="104" />
    <country countryname="NAMIBIA" twoletterisoregionname="NA" threeletterisoregionname="NAM" countrycode="516" />
    <country countryname="NAURU" twoletterisoregionname="NR" threeletterisoregionname="NRU" countrycode="520" />
    <country countryname="NEPAL" twoletterisoregionname="NP" threeletterisoregionname="NPL" countrycode="524" />
    <country countryname="NETHERLANDS" twoletterisoregionname="NL" threeletterisoregionname="NLD" countrycode="528" />
    <country countryname="NETHERLANDS ANTILLES" twoletterisoregionname="AN" threeletterisoregionname="ANT" countrycode="530" />
    <country countryname="NEW CALEDONIA" twoletterisoregionname="NC" threeletterisoregionname="NCL" countrycode="540" />
    <country countryname="NEW ZEALAND" twoletterisoregionname="NZ" threeletterisoregionname="NZL" countrycode="554" />
    <country countryname="NICARAGUA" twoletterisoregionname="NI" threeletterisoregionname="NIC" countrycode="558" />
    <country countryname="NIGER" twoletterisoregionname="NE" threeletterisoregionname="NER" countrycode="562" />
    <country countryname="NIGERIA" twoletterisoregionname="NG" threeletterisoregionname="NGA" countrycode="566" />
    <country countryname="NIUE" twoletterisoregionname="NU" threeletterisoregionname="NIU" countrycode="570" />
    <country countryname="NORFOLK ISLAND" twoletterisoregionname="NF" threeletterisoregionname="NFK" countrycode="574" />
    <country countryname="NORTHERN MARIANA ISLANDS" twoletterisoregionname="MP" threeletterisoregionname="MNP" countrycode="580" />
    <country countryname="NORWAY" twoletterisoregionname="NO" threeletterisoregionname="NOR" countrycode="578" />
    <country countryname="OMAN" twoletterisoregionname="OM" threeletterisoregionname="OMN" countrycode="512" />
    <country countryname="PAKISTAN" twoletterisoregionname="PK" threeletterisoregionname="PAK" countrycode="586" />
    <country countryname="PALAU" twoletterisoregionname="PW" threeletterisoregionname="PLW" countrycode="585" />
    <country countryname="PANAMA" twoletterisoregionname="PA" threeletterisoregionname="PAN" countrycode="590" />
    <country countryname="PAPUA NEW GUINEA" twoletterisoregionname="PG" threeletterisoregionname="PNG" countrycode="598" />
    <country countryname="PARAGUAY" twoletterisoregionname="PY" threeletterisoregionname="PRY" countrycode="600" />
    <country countryname="PERU" twoletterisoregionname="PE" threeletterisoregionname="PER" countrycode="604" />
    <country countryname="PHILIPPINES" twoletterisoregionname="PH" threeletterisoregionname="PHL" countrycode="608" />
    <country countryname="PITCAIRN" twoletterisoregionname="PN" threeletterisoregionname="PCN" countrycode="612" />
    <country countryname="POLAND" twoletterisoregionname="PL" threeletterisoregionname="POL" countrycode="616" />
    <country countryname="PORTUGAL" twoletterisoregionname="PT" threeletterisoregionname="PRT" countrycode="620" />
    <country countryname="PUERTO RICO" twoletterisoregionname="PR" threeletterisoregionname="PRI" countrycode="630" />
    <country countryname="QATAR" twoletterisoregionname="QA" threeletterisoregionname="QAT" countrycode="634" />
    <country countryname="REUNION" twoletterisoregionname="RE" threeletterisoregionname="REU" countrycode="638" />
    <country countryname="ROMANIA" twoletterisoregionname="RO" threeletterisoregionname="ROM" countrycode="642" />
    <country countryname="RUSSIAN FEDERATION" twoletterisoregionname="RU" threeletterisoregionname="RUS" countrycode="643" />
    <country countryname="RWANDA" twoletterisoregionname="RW" threeletterisoregionname="RWA" countrycode="646" />
    <country countryname="SAINT KITTS AND NEVIS" twoletterisoregionname="KN" threeletterisoregionname="KNA" countrycode="659" />
    <country countryname="SAINT LUCIA" twoletterisoregionname="LC" threeletterisoregionname="LCA" countrycode="662" />
    <country countryname="SAINT VINCENT AND THE GRENADINES" twoletterisoregionname="VC" threeletterisoregionname="VCT" countrycode="670" />
    <country countryname="SAMOA" twoletterisoregionname="WS" threeletterisoregionname="WSM" countrycode="882" />
    <country countryname="SAN MARINO" twoletterisoregionname="SM" threeletterisoregionname="SMR" countrycode="674" />
    <country countryname="SAO TOME AND PRINCIPE" twoletterisoregionname="ST" threeletterisoregionname="STP" countrycode="678" />
    <country countryname="SAUDI ARABIA" twoletterisoregionname="SA" threeletterisoregionname="SAU" countrycode="682" />
    <country countryname="SENEGAL" twoletterisoregionname="SN" threeletterisoregionname="SEN" countrycode="686" />
    <country countryname="SEYCHELLES" twoletterisoregionname="SC" threeletterisoregionname="SYC" countrycode="690" />
    <country countryname="SIERRA LEONE" twoletterisoregionname="SL" threeletterisoregionname="SLE" countrycode="694" />
    <country countryname="SINGAPORE" twoletterisoregionname="SG" threeletterisoregionname="SGP" countrycode="702" />
    <country countryname="SLOVAKIA (Slovak Republic)" twoletterisoregionname="SK" threeletterisoregionname="SVK" countrycode="703" />
    <country countryname="SLOVENIA" twoletterisoregionname="SI" threeletterisoregionname="SVN" countrycode="705" />
    <country countryname="SOLOMON ISLANDS" twoletterisoregionname="SB" threeletterisoregionname="SLB" countrycode="090" />
    <country countryname="SOMALIA" twoletterisoregionname="SO" threeletterisoregionname="SOM" countrycode="706" />
    <country countryname="SOUTH AFRICA" twoletterisoregionname="ZA" threeletterisoregionname="ZAF" countrycode="710" />
    <country countryname="SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS" twoletterisoregionname="GS" threeletterisoregionname="SGS" countrycode="239" />
    <country countryname="SPAIN" twoletterisoregionname="ES" threeletterisoregionname="ESP" countrycode="724" />
    <country countryname="SRI LANKA" twoletterisoregionname="LK" threeletterisoregionname="LKA" countrycode="144" />
    <country countryname="ST. HELENA" twoletterisoregionname="SH" threeletterisoregionname="SHN" countrycode="654" />
    <country countryname="ST. PIERRE AND MIQUELON" twoletterisoregionname="PM" threeletterisoregionname="SPM" countrycode="666" />
    <country countryname="SUDAN" twoletterisoregionname="SD" threeletterisoregionname="SDN" countrycode="736" />
    <country countryname="SURINAME" twoletterisoregionname="SR" threeletterisoregionname="SUR" countrycode="740" />
    <country countryname="SVALBARD AND JAN MAYEN ISLANDS" twoletterisoregionname="SJ" threeletterisoregionname="SJM" countrycode="744" />
    <country countryname="SWAZILAND" twoletterisoregionname="SZ" threeletterisoregionname="SWZ" countrycode="748" />
    <country countryname="SWEDEN" twoletterisoregionname="SE" threeletterisoregionname="SWE" countrycode="752" />
    <country countryname="SWITZERLAND" twoletterisoregionname="CH" threeletterisoregionname="CHE" countrycode="756" />
    <country countryname="SYRIAN ARAB REPUBLIC" twoletterisoregionname="SY" threeletterisoregionname="SYR" countrycode="760" />
    <country countryname="TAIWAN" twoletterisoregionname="TW" threeletterisoregionname="TWN" countrycode="158" />
    <country countryname="TAJIKISTAN" twoletterisoregionname="TJ" threeletterisoregionname="TJK" countrycode="762" />
    <country countryname="TANZANIA, UNITED REPUBLIC OF" twoletterisoregionname="TZ" threeletterisoregionname="TZA" countrycode="834" />
    <country countryname="THAILAND" twoletterisoregionname="TH" threeletterisoregionname="THA" countrycode="764" />
    <country countryname="TOGO" twoletterisoregionname="TG" threeletterisoregionname="TGO" countrycode="768" />
    <country countryname="TOKELAU" twoletterisoregionname="TK" threeletterisoregionname="TKL" countrycode="772" />
    <country countryname="TONGA" twoletterisoregionname="TO" threeletterisoregionname="TON" countrycode="776" />
    <country countryname="TRINIDAD AND TOBAGO" twoletterisoregionname="TT" threeletterisoregionname="TTO" countrycode="780" />
    <country countryname="TUNISIA" twoletterisoregionname="TN" threeletterisoregionname="TUN" countrycode="788" />
    <country countryname="TURKEY" twoletterisoregionname="TR" threeletterisoregionname="TUR" countrycode="792" />
    <country countryname="TURKMENISTAN" twoletterisoregionname="TM" threeletterisoregionname="TKM" countrycode="795" />
    <country countryname="TURKS AND CAICOS ISLANDS" twoletterisoregionname="TC" threeletterisoregionname="TCA" countrycode="796" />
    <country countryname="TUVALU" twoletterisoregionname="TV" threeletterisoregionname="TUV" countrycode="798" />
    <country countryname="UGANDA" twoletterisoregionname="UG" threeletterisoregionname="UGA" countrycode="800" />
    <country countryname="UKRAINE" twoletterisoregionname="UA" threeletterisoregionname="UKR" countrycode="804" />
    <country countryname="UNITED ARAB EMIRATES" twoletterisoregionname="AE" threeletterisoregionname="ARE" countrycode="784" />
    <country countryname="UNITED KINGDOM" twoletterisoregionname="GB" threeletterisoregionname="GBR" countrycode="826" />
    <country countryname="UNITED STATES" twoletterisoregionname="US" threeletterisoregionname="USA" countrycode="840" />
    <country countryname="UNITED STATES MINOR OUTLYING ISLANDS" twoletterisoregionname="UM" threeletterisoregionname="UMI" countrycode="581" />
    <country countryname="URUGUAY" twoletterisoregionname="UY" threeletterisoregionname="URY" countrycode="858" />
    <country countryname="UZBEKISTAN" twoletterisoregionname="UZ" threeletterisoregionname="UZB" countrycode="860" />
    <country countryname="VANUATU" twoletterisoregionname="VU" threeletterisoregionname="VUT" countrycode="548" />
    <country countryname="VENEZUELA" twoletterisoregionname="VE" threeletterisoregionname="VEN" countrycode="862" />
    <country countryname="VIET NAM" twoletterisoregionname="VN" threeletterisoregionname="VNM" countrycode="704" />
    <country countryname="VIRGIN ISLANDS (BRITISH)" twoletterisoregionname="VG" threeletterisoregionname="VGB" countrycode="092" />
    <country countryname="VIRGIN ISLANDS (U.S.)" twoletterisoregionname="VI" threeletterisoregionname="VIR" countrycode="850" />
    <country countryname="WALLIS AND FUTUNA ISLANDS" twoletterisoregionname="WF" threeletterisoregionname="WLF" countrycode="876" />
    <country countryname="WESTERN SAHARA" twoletterisoregionname="EH" threeletterisoregionname="ESH" countrycode="732" />
    <country countryname="YEMEN" twoletterisoregionname="YE" threeletterisoregionname="YEM" countrycode="887" />
    <country countryname="YUGOSLAVIA" twoletterisoregionname="YU" threeletterisoregionname="YUG" countrycode="891" />
    <country countryname="ZAIRE" twoletterisoregionname="ZR" threeletterisoregionname="ZAR" countrycode="180" />
    <country countryname="ZAMBIA" twoletterisoregionname="ZM" threeletterisoregionname="ZMB" countrycode="894" />
    <country countryname="ZIMBABWE" twoletterisoregionname="ZW" threeletterisoregionname="ZWE" countrycode="716" />
  </countries>


Code


C#
protected void Page_Load(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
    ds.ReadXml("C:\\Countries.XML");
    ddlLocation.DataSource = ds;
    ddlLocation.DataTextField = "CountryName";
    ddlLocation.DataValueField = "TwoLetterISORegionName";
    ddlLocation.DataBind();
}

Advantages



  • Here, Country names are loading from code behind so we can apply some filter/restriction for the items list here.(Example: Loading European countries, Loading Country names starts with 'A', etc.).
  • Here TwoLetterISORegionName is used to DataValueField for DropDownList but we can use other things such as ThreeLetterISORegionName, CountryCode. BTW, you should add the fields which you want in XML file.
  • We can sort the fields in DataSet.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)