In fact I think you can use XmlDocument or LINQ-TO-XML and do a "nested" databinding。Something looks like this following:
【Solutions】
var result = from e in XDocument.Load("xxx.xml").Descedants("Floor")
select new
{
FloorName = e.Value,
DepartNames = from f in e.Descedants("Department")
select f.Value
}
And then your GridView should be something like this:
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get XML file into a grid view
Apr 14, 2012 01:52 AM|LINK
Hello bprego:)
【Reasons】
In fact I think you can use XmlDocument or LINQ-TO-XML and do a "nested" databinding。Something looks like this following:
【Solutions】
var result = from e in XDocument.Load("xxx.xml").Descedants("Floor") select new { FloorName = e.Value, DepartNames = from f in e.Descedants("Department") select f.Value }And then your GridView should be something like this:
<ItemTemplate>
<%#Eval("FloorName")%>
</ItemTemplate>
</asp:Template>
<asp:Template HeaderText="Departments"><ItemTemplate>
<Columns><ItemTemplate>
<%#Eval("Department")%>
</ItemTemplate>
</Columns></ItemTemplate>
</asp:Template>
Your code-behind is: