Reputation: 2930
I have GridView
mGridView
with 3 columns - Process
, Description
and Type
.
I have xml
with the content like this:
<root>
<Rows>
<Row Name="fdf" Description="dfaf" Type="A" >
</Row>
<Row Name="Sff" />
<Row Name="XYZ" Type="PH">
</Row>
</Rows>
</root>
where there are 3 Attributes (Name, Description and Type) and they are not obligatory. How to make the DataSource
of mGridView
to be this xml and every mGridViev
Row
to be filled with the 3 values of the tree atributes in the Row from the xml?
Upvotes: 1
Views: 1102
Reputation: 11376
If I understand your task properly, the following code with your xml file works fine:
private void Form1_Load(object sender, EventArgs e) {
DataSet ds = new DataSet();
ds.ReadXml(@"XMLFile1.xml");
gridControl1.DataSource = ds.Tables[1];
gridView1.PopulateColumns();
}
Please also try to call the gridView's PopulateColumns method. Does this help?
Upvotes: 1