Binding XML to an ASP.NET Gridview

ghfever

New Member
I have an XML document like this:\[code\]<?xml version="1.0" encoding="UTF-8"?><cars> <car type="Wagon" make="Volvo"> <colours> <colour>Red</colour> <colour>Yellow</colour> </colours> </car> <car type="Sedan" make="Audi"> <colours> <colour>Green</colour> <colour>Blue</colour> </colours> </car></cars>\[/code\]This is being generated by an ASP.NET XmlDataSource which uses an XSL file to transform the XML output of a HTTP URL.I want to bind the XmlDataSource to an ASP.NET gridview, but when using auto-generate columns, only the type and make attributes are being bound.I want the colours of the cars bound to a third column in CSV format like this:\[code\]Type Make ColoursWagon Volvo Red, YellowSedan Audi Green, Blue\[/code\]I understand that could modify my transform file to store the colours in an XML attribute, but then this would make it hard to filter the XmlDataSource on colour.I am planning on modifying the XmlDataSource's Xpath property dynamically in order the filter the data being displayed.Is there any way I can achieve this functionality using ASP.NET. I have .NET Framework 4.0 at my disposal.
 
Back
Top