Open XML Data file into Gridview

Posted by Mindless under Regular Expressions on 2/24/2011 | Points: 10 | Views : 2133 | Status : [Member] | Replies : 5
Hi
Can anyone help me to open XML file in GridView Control when I am trying to open "Books.xlm" file in my gridview control with xml datasoruce the first header is s <book id = "bk1001"> is come out but not other fields e.g. "auther", 'Price" and "Title" disappear I see jsut one column in my gridview which is "id" Please help.

Thanks




Responses

Posted by: Madhu.b.rokkam on: 2/24/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
you can use as

dataset.readxml(pathofxmlfile);
gridview.datasource = dataset.tables[0];
gridview.databind();

Thanks and Regards
Madhu

Mindless, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 2/25/2011 [Member] Starter | Points: 25

Up
0
Down
hi...
First you can read all the xml nodes into datatable,and then bind the datatable in gridview..
even if you have any doubt how to read xml node refer this site
http://vbdotnetaddict.blogspot.com/2011/02/how-to-insert-xml-data-into-sql.html

Mindless, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 2/27/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Nice links!!

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Mindless, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/27/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Guys good asnwers, please dont forget to put your example code inside the code Tags.

Thank you for posting at Dotnetfunda
[Administrator]

Mindless, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/27/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Sure Vuyiswamb .. Thanks again for reminding us

Thanks and Regards
Madhu

Mindless, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response