Binding XML to Datagrid

D

Do

Hi,

I tried to bind an XML similar to the following to a datagrid.

<Idontwant>
<Iwant>
<Yes></Yes>
<Yes></Yes>
<Yes></Yes>
<Yes></Yes>
<Yes></Yes>
</Iwant>
</Idontwant>

The datagrid comes up with nothing. When I remove the node 'Idontwant' and
have the
'Iwant' and the root node, everything shows up correctly in the datagrid.
But removing the
'Idontwant' node is not an option of mine.

I want to be selective on the level or group of nodes that I bind to the
datagrid, so I can just
choose everything in //Idontwant/Iwant. How do choose just a portion of the
XML structure?

Code examples and links would be awesome!

Thanks,

Do
 
K

Ken Cox [Microsoft MVP]

Hi Do,

Try drilling down into the Tables collection to see if that brings back the
data you want:

Dim ds As New DataSet
ds.ReadXml(Server.MapPath("dbxml.xml"))
DataGrid1.DataSource = ds.Tables(1)
DataGrid1.DataBind()

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top