Groups | Blog | Home
all groups > dotnet xml > july 2003 >

dotnet xml : Reading data node by node from an XML file and binding to a grid


dineshbabu_gr NO[at]SPAM hotmail.com
7/14/2003 12:32:25 PM
Hi all,

I have many parent tags and many child tags under the respective
parent.. in an XML file.

On the click of a button the application should pick up the one parent
and the corresponding child and bind it to a grid.

Like that it goes on for the next parent and the related child for the
next button click.


Pls give me an idea of how to do this. If possible do help me with the
code.

Thanks in advance,
Sergey Dubinets
7/15/2003 6:30:23 PM
You can load your xml file to XmlDocument (or XPathDocumen if you don't
plane to edit xml),
and then you can navigate through XmlDocument node by node in old fashion
way to create XPathNavigator and move it through document (on each button
click).

If you don't need actual nodes but only values of these nodes you can avoid
caching all of them by reading xml file with XmlTextReader and preserving
only required data (in ArrayList for example).

So you have plenty of options and which is better depend on your scenario.
Sergey
--
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

dineshbabu_gr NO[at]SPAM hotmail.com
7/16/2003 3:06:16 AM
Thanks a lot Mr.Sergey.

I could follow up ur words. But still it would be very helpful if u
could post some code realted to this. In the meanwhile i try on my
side.

Thanks once again for ur response.

Regards,
Dinesh.












[quoted text, click to view]
Kirk Allen Evans
7/16/2003 11:18:07 AM
I have an example of binding an XmlNodeList to a datagrid on my web log [1].
On each button click, you can select a new XmlNodeList and bind it to the
datagrid.

[1] http://weblogs.asp.net/kaevans/posts/9713.aspx

--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans


[quoted text, click to view]

AddThis Social Bookmark Button