http://www.techrepublic.com/blog/programming-and-development/access-xml-data-using-linq-to-xml/594
http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx
http://www.dbtutorials.com/retrieve/linq-to-xml-cs.aspx
XDocument xmlDoc = XDocument.Load(Server.MapPath("personkrs.xml"));
var persons = from person in xmlDoc.Descendants("Person")
select new
{
Name = person.Element("Name").Value,
City = person.Element("City").Value,
//Age = person.Element("Age").Value,
};
GridView1.DataSource = persons;
GridView1.DataBind();
No comments:
Post a Comment