I am attempting to bind linq-to-xml query to a gridview.
I have the following XML
<?xml version="1.0" encoding="utf-8" ?>
<thesaurus xmlns="x-schema:tsSchema.xml">
<diacritics_sensitive>0</diacritics_sensitive>
<expansion>
<sub>satellite navigation</sub>
<sub>sat-nav</sub>
<sub>Sat Nav</sub>
<sub>tom tom</sub>
</expansion>
<expansion>
<sub>Car</sub>
<sub>Vehicle</sub>
<sub>Motor</sub>
<sub>Wheels</sub>
<sub>Ride</sub>
</expansion>
</thesaurus>
I use the following Linq Query
var query = from term in xDocumentTerms.Elements(tns + "thesaurus").Elements(tns + "expansion").Elements(tns + "sub")
where term.Value == val
select term.Parent.Descendants().ToList<XElement>();
gridview_RelatedTerms.DataSource =query;
gridview_RelatedTerms.DataBind();
Which returns data, however binds the count and the capacity of the List opposed to what I would really like the XElement.Value.