By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,890 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,890 IT Pros & Developers. It's quick & easy.

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

P: n/a
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,
Dinesh.
Nov 11 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

"Dinesh_GR" <di***********@hotmail.com> wrote in message
news:d7**************************@posting.google.c om...
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,
Dinesh.

Nov 11 '05 #2

P: n/a
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.




"Sergey Dubinets" <sd**@online.microsoft.com> wrote in message news:<uJ**************@TK2MSFTNGP12.phx.gbl>...
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.

"Dinesh_GR" <di***********@hotmail.com> wrote in message
news:d7**************************@posting.google.c om...
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,
Dinesh.

Nov 11 '05 #3

P: n/a
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
"Dinesh_GR" <di***********@hotmail.com> wrote in message
news:d7**************************@posting.google.c om...
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.




"Sergey Dubinets" <sd**@online.microsoft.com> wrote in message

news:<uJ**************@TK2MSFTNGP12.phx.gbl>...
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.
"Dinesh_GR" <di***********@hotmail.com> wrote in message
news:d7**************************@posting.google.c om...
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,
Dinesh.

Nov 11 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.