asp.net: Bind XML from Webservice to a dropdownlist
how do i bind a xml (http://www.webservicex.net/country.asmx/GetCountries) to 开发者_开发问答a dropdownlist? Currently I'm working with ASP.NET 2.0.
Greetings...
thx Marko, finally:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myGeoService As New net.webservicex.www.country
Dim myISOcodes As String = myGeoService.GetCountries
Dim reader As New System.IO.StringReader(myISOcodes)
If Not Page.IsPostBack Then
Dim mycountries As New DataSet
mycountries.ReadXml(reader)
DropDownList1.DataSource = mycountries
'DropDownList1.DataValueField = "value"
DropDownList1.DataTextField = "Name"
DropDownList1.DataBind()
End If
End Sub
First, call your web service from code behind... Then bind xml that you get from a web service to a dropdown. On this link you have how to do that:
http://forums.asp.net/t/999571.aspx
cheers
精彩评论