views:

237

answers:

1

i am trying to load this xml file into the dropdownlist:

http://sites.google.com/site/shadchanproject/Home/lots1.xml

i want to only load the a7190, a7193 etc... (there are only three of them i believe)

please help!

i am doing this in asp.net

+1  A: 

Hmm, I'm having issues downloading the file.

But in general, if you can download the XML file and create an XSD file based off this (there are several XSD generators out there), you can then create a DataSet object that will read the XML data into a DataTable.

From there, you can create a DataView, filter out the other items so that only the desired elements remain, and bind the DataView to the drop down list.

EDIT: Well, I looked and its simpler than that. You should be able to read the XML file straight in. You won't have a strongly typed table, but you can do this:

Dim dsStuff As New DataSet()
dsStuff.ReadXml("PathToFile")

Dim dvStuff As New DataView(dsStuff.Tables(0))
dvStuff.Sort = "Name = 'FilteredName'"

ddlStuff.DataSource = dvStuff
ddlStuff.DataTextField = "Name"  
ddlStuff.DataValueField = "ID"  

ddlStuff.DataBind()

Adjust the filter criteria accordingly.

Dillie-O
hey actually im sorry im a beginnner and i need something extremely simple. can you point me to a simple example that reads an XML and puts it into a dropdownlist in asp.net?
I__
Check the update, I think this will work.
Dillie-O