Sorry but in the nested GridView's DataSource you should say "DepartNames" instead of "DeptName"……;Well,plz attention to my complete codes——
【cs code-behind】
protected void Page_Load(object sender, EventArgs e)
{
string filePath3 = Server.MapPath("App_Data/test.xml");
var result = from f in XDocument.Load(filePath3).Descendants("Floor")
select new
{
FloorName = f.Value,
DepartNames = from g in f.Descendants("DeptName")
select g.Value
};
}
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: get XML file into a grid view
Apr 18, 2012 01:07 AM|LINK
Hello bprego:)
Sorry but in the nested GridView's DataSource you should say "DepartNames" instead of "DeptName"……;Well,plz attention to my complete codes——
【cs code-behind】
protected void Page_Load(object sender, EventArgs e) { string filePath3 = Server.MapPath("App_Data/test.xml"); var result = from f in XDocument.Load(filePath3).Descendants("Floor") select new { FloorName = f.Value, DepartNames = from g in f.Descendants("DeptName") select g.Value }; }【aspx codes】