views:

119

answers:

1

The following code:

DataSet ds = new DataSet;
ds.ReadXml("c:\output\" + nome);
GridView1.DataSource = ds;
GridView1.DataBind();

succeeds in getting the fields from the XML, but as default it only displays the three first fields (this XML specially may have about 60 fields, of which i wish to gather 3 or 4 of them)

how do i take off these fields and choose the fields that i want?

facts:
i know the names of the fields
i have unlimited space for the xml datagrid display
i don't need links or anything, just normal display of data
i'd like to know aso if there's a way of loading more than one xml into a datagrid (several rows)
answer either in c# or vb.net.. there's no problem

+1  A: 

Done it. Used data table as the binding. in each column i chose the desired field and then in each row creating routine i got the data from the dataset just like i would normally:

Dim dt As DataTable = New DataTable()
Dim dr As Data.DataRow = Nothing

(... column creating...)

dr(0) = ds.Tables("<xml table>").Rows(0)("xml field>")
...
...

after everything, i just bind it to a gridview:

GridView1.DataSource = dt
GridView1.DataBind()

Thank you.

MarceloRamires