Hello,
Please help me in reading this multilevel xml to a RadGrid. 1) I am planning not to use Aspx for this 2) The node named Item would eventually change as per app Requirements. So, I don't want to restrict my xpath to something like "//Product/Item"
<Products>
<Product ProductID="1">
<Item ItemID="1">
<ProductNo>1234</ProductNo>
<Description>
<ManufacDate>20100526T12:00:01.012</ManufacDate>
<ManufacID>72</ManufacID>
</Description>
</Item>
<Item ItemID="2">
<ProductNo>1235</ProductNo>
<Description>
<ManufacDate>20100527T12:00:01.012</ManufacDate>
<ManufacID>72</ManufacID>
</Description>
</Item>
<Item ItemID="3">
<ProductNo>1236</ProductNo>
<Description>
<ManufacDate>20100528T12:00:01.012</ManufacDate>
<ManufacID>66</ManufacID>
</Description>
</Item>
</Product></Products>
I am reading this xml from codebehind and iterating through xmlnodes to display in the grid. Please find my snippet below:
Dim root as new xmldocument()
' After loading the above xml into root
Dim ndl As XmlNodeList = root.SelectNodes("//Products")
For Each chNode As XmlNode In ndl
Dim chObjNode As XmlNodeList = root.SelectNodes("descendant::node()[ancestor::Product[@ProductID=""1""]]")
For Each XNode As XmlNode In chObjNode
ds.ReadXml(New XmlNodeReader(XNode))
Next
Next
radgrid1.datasource = ds
radgrid1.databind()
Taking this into reference. It would be great if you can help me correct or provide a solution to this issue without converting to XSL. I need the Columns: ItemID, ProductNo, indented Description with ManufacDate and ManufacID. I m not sure how to get this displayed.
Thanks