asp.net:将Web服务中的XML绑定到下拉列表中
问题描述:
如何将xml(http://www.webservicex.net/country.asmx/GetCountries)绑定到下拉列表?目前我正在使用ASP.NET 2.0。asp.net:将Web服务中的XML绑定到下拉列表中
问候......
答
THX马尔科,最后:
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
+0
我很高兴我帮助过...干杯 – Marko 2010-07-19 22:12:30
我已经叫 昏暗myGeoService作为新net.webservicex.www .country Dim myISOcodes As String = myGeoService.GetCountries 但myISOcodes只是字符串。接下来的问题是如何将字符串更改为数据集? – user168507 2010-07-19 10:33:30
GetCountries返回什么? – Marko 2010-07-19 11:33:02
在浏览器中打开 http://www.webservicex.net/country.asmx/GetCountries – user168507 2010-07-19 11:57:13