1
Answer

How to display Country dial code based on country name in C#

Dear Sir,
 
I need your help to display country code based on county name selection.
 
 
Like screenshot above. if I select India , the country dail code  has to be display in next textbox.
 
Country name are in DropDown list. 
Answers (1)
0
Ankit Sharma

Ankit Sharma

NA 8.8k 140.9k 7y
Hi,
 
you can follow these approaches .
 
1. Call third party free webservice and bind the data to your ddl and textbox
 
This is a free webservice available. 
  http://www.webservicex.net/country.asmx?op=GetISD 
 
 But the downside of this approach is that you don't have control over availability of webservice.so you may find it inaccessible at times.
 
2. Create your own table in Database and bind it to ddl and textbox.
 
you can get the desired data here
 
https://countrycode.org/ 
 
this is a preffered approach  as you have control over your own table
 
3. This link will give you country code data in Json format.So your work become even more easier as you dont need any DB calls.
 
https://gist.github.com/iamswapnilsonar/0e1868229e98cc27a6d2e3487b44f7fa
 
Just bind the values to your control.