Thursday, August 9, 2007

Read XML data and bind to datagridview .NET

if you want to bind xml data to your datagrid, you need do as below:

dataSet1.ReadXml("kwyProducts.xml");
dataGridView1.DataSource =
dataSet1;
dataGridView1.DataMember = "KWYProducts";

Notes: please specify your DataMember correctly else will throw you this error:

Child list for field KWYProduscts cannot be created.

8 comments:

Anonymous said...

Thank Heaven for friendly bloggers! Short, sweet and exactly what I needed. Thanks, Buddy!

Owen Leong said...

Well, I am glad that i had help you. Happy coding.

cjb said...

How can you identify what the DataMember property should be?

Anonymous said...

But how to solve this problem plz help....

Atif said...

Just assigning the dataset as the datasource has resolved this problem in my case where i was assigning dataset.tables(0) as datasource

Nikola said...

Thank you man a lot! You saved my day! Finally I see my XML table :)

Pravesh Singh said...

Check this helpful link too...
Populate Grid Control From XML Document Easily

Thanks

Anonymous said...


When the winds died down, she realized a car was blocking her exit. "It took some muscle, but I got out," Vrooman said, as she sifted through piles [url=http://www.agoshow.net/2009-All-Star-New-York-Mets-5-David-Wright-Red-Jerseys-9/]2009 All Star New York Mets 5 David Wright Red Jerseys[/url] of clothing, broken knickknacks and nail-studded boards that had once been her home. The tornado on Monday afternoon flattened entire blocks of the town, including schools, a hospital and other buildings. At least 24 people were killed and 240 others injured, but authorities were increasingly confident that everyone caught in the disaster had been accounted for, despite initial fears that the twister had claimed the lives of more than 90 people. Jerry Lojka, spokesman for Oklahoma Emergency Management, said search-and-rescue dog teams would search for anybody trapped under the rubble, but that attention would also [url=http://www.agoshow.net/Tigers-24-Miguel-Cabrera-Red-2010-All-Star-Jerseys-60/]Tigers 24 Miguel Cabrera Red 2010 All Star Jerseys[/url] be focused on a huge cleanup job. "They will continue the searches of areas to be sure nothing is overlooked," he said. "There's going to be more of a transition to recovery." More than 1,000 people had already registered for assistance from the Federal Emergency Management Agency, or FEMA, which sent hundreds of workers to Oklahoma to help with the recovery. After a long day of searching [url=http://www.agoshow.net/Braves-10-Jones-Black-2011-All-Star-Jerseys-104/]Braves 10 Jones Black 2011 All Star Jerseys[/url] through shattered homes that was slowed by rainy weather on Tuesday, Oklahoma County Commissioner Brian Maughan said it seemed no one was missing. "As far as I know, of the list of people that we have had that they are all accounted for in one way or another," he said. TEN CHILDREN AMONG DEAD The state medical examiner on Wednesday released details on the people who died in the [url=http://www.agoshow.net/2009-All-Star-New-York-Yankees-2-Derek-Jeter-Blue-Jerseys-13/]2009 All Star New York Yankees 2 Derek Jeter Blue Jerseys[/url] storm, and reported 10 children, including a four-month-old baby, were among the victims, more than the nine previously reported. The other children ranged in age from 4 years to 9 years old. The storm's oldest victim, of those whose ages were released, was 63. Most of the victims died of blunt force injuries that were probably caused by flying debris and five of the children died from suffocation. Most of the children were at Plaza Towers Elementary School, which took a direct hit by the deadliest tornado to strike the United States in two years. Emergency workers pulled more than [url=http://www.agoshow.net/Yankees-42-Mariano-Rivera-red-2010-All-Star-Jerseys-68/]Yankees 42 Mariano Rivera red 2010 All Star Jerseys[/url] 100 survivors from the debris after the tornado ripped through the Oklahoma City region with winds exceeding 200 miles per hour, leaving a trail of destruction 17 miles long and 1.3 miles wide. The National Weather Service said the tornado was ranked a rare EF5, the most powerful on the Enhanced Fujita Scale. STORM SAFE SHELTERS The last time a giant twister tore through the area, on May 3, 1999, it killed more than 40 people and destroyed thousands of homes. That tornado also topped the scale.


[url=http://wvsforum.com/member.php?u=54503]more[/url]