for example CustomerFirstName will be "Elad" just like in my xml
+ the field CustomerPhoto is the binary value of the user profile image that was stored in the DB
To read out the whole xml,you can use LINQ-TO-XML to fetch the collection result and then bind to the GridView:Considering it that one man may have many movies,so you should nest another GridView in the parent GridView to show all the images that belongs
to a certain man。
【Sample】
var result = from c in XDocument.Load("xxx.xml").Descedants("Customer")
select new
{
CustomerId = c.Element("CustomerId").Value,
CustomerFirstName = c.Element("CustomerFirstName").Value,
………………
Movies = from m in c.Element("MoviesToCustomer").Elements()
select m.Value
};
eladc
Member
32 Points
89 Posts
Reading an xml with out using the build-in controls
May 07, 2012 06:46 AM|LINK
im trying to figure out how to read my file (report.xml)
this is what it looks like
i want to create an aspx page that looks like this - http://i47.tinypic.com/2q022e0.png
for example CustomerFirstName will be "Elad" just like in my xml
+ the field CustomerPhoto is the binary value of the user profile image that was stored in the DB
how can i display it (the binary data) ?
amit.jain
Star
11225 Points
1815 Posts
Re: Reading an xml with out using the build-in controls
May 07, 2012 12:22 PM|LINK
you can read xml into datatable or use xmldatasource to display data in gridview
http://csharpdotnetfreak.blogspot.com/2012/06/read-xml-file-into-datatable-aspnet-cvb.html
http://csharpdotnetfreak.blogspot.com/2011/12/gridview-xmldatasource-example.html
You can display images from db as mentioned in below link
http://csharpdotnetfreak.blogspot.com/2009/07/display-images-gridview-from-database.html
amiT jaiN
ASP.NET C# VB Articles And Code Examples
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Reading an xml with out using the build-in controls
May 09, 2012 01:45 AM|LINK
My additionto amit.jain:)
To read out the whole xml,you can use LINQ-TO-XML to fetch the collection result and then bind to the GridView:Considering it that one man may have many movies,so you should nest another GridView in the parent GridView to show all the images that belongs to a certain man。
【Sample】
var result = from c in XDocument.Load("xxx.xml").Descedants("Customer") select new { CustomerId = c.Element("CustomerId").Value, CustomerFirstName = c.Element("CustomerFirstName").Value, ……………… Movies = from m in c.Element("MoviesToCustomer").Elements() select m.Value };