Vuk Stanojevic

Vuk Stanojevic

  • 1.6k
  • 140
  • 45.6k

C# load data to datagridview from xml

May 19 2020 12:30 PM
Hi Everyone,
i have a problem with importing data from xml to datagridview.
It load's only first part on xml, but not what i really need from xml.
 
Here is code:
 
private void btnSelect_Click_1(object sender, EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "XML Files |*.xml";
fd.ShowDialog();
string path = fd.FileName;
DataSet ds = new DataSet();
ds.ReadXml(path);
dataGridView1.DataSource = ds.Tables[0];
}
 
and here is result:
 
 
 Bellow you can see xtml which i want to load and i select in yellow what i want to show in datagridview,for each item in xml.
Values marked in yellow is what i want to show in datagridview, and first  part which is surrounded with yellow is info which i get now in datagridview but which i don't want.
 
can you help me to solve this issue?
 
Thank you very much. 

Answers (10)