Hi nauna,
Check this example. Now please take its reference and correct your code.
HTML
<div align="center">
<asp:DropDownList runat="server" ID="ddlExchangeRates" Width="100px">
</asp:DropDownList>
</div>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string json = (new System.Net.WebClient()).DownloadString("https://api.exchangeratesapi.io/latest");
System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
KeyValuePair<string, object> rates = js.Deserialize<Dictionary<string, object>>(json)
.Where(x => x.Key == "rates").FirstOrDefault();
ddlExchangeRates.DataSource = rates.Value;
ddlExchangeRates.DataTextField = "Key";
ddlExchangeRates.DataValueField = "Value";
ddlExchangeRates.DataBind();
ddlExchangeRates.Items.Insert(0, new ListItem("Select", "0"));
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim json As String = (New System.Net.WebClient()).DownloadString("https://api.exchangeratesapi.io/latest")
Dim js As Script.Serialization.JavaScriptSerializer = New Script.Serialization.JavaScriptSerializer()
Dim rates As KeyValuePair(Of String, Object) = js.Deserialize(Of Dictionary(Of String, Object))(json) _
.Where(Function(x) x.Key = "rates").FirstOrDefault()
ddlExchangeRates.DataSource = rates.Value
ddlExchangeRates.DataTextField = "Key"
ddlExchangeRates.DataValueField = "Value"
ddlExchangeRates.DataBind()
ddlExchangeRates.Items.Insert(0, New ListItem("Select", "0"))
End If
End Sub
Screenshot