473,785 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
3 4837
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.goo gle.com...
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
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.mi crosoft.com> wrote in message news:<uJ******* *******@TK2MSFT NGP12.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.goo gle.com...
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
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.goo gle.com...
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.mi crosoft.com> wrote in message

news:<uJ******* *******@TK2MSFT NGP12.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.goo gle.com...
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2045
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The data fetch only takes 5 secs, why does paint and load take 40 secs in total.
0
2350
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a visual representation of data. Two types of data binding are available for Windows Forms: Simple Data Binding and Complex Data Binding. Simple data binding allows you to bind one data element to a control. In many situations you want to display...
5
2517
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to have a separate data adapter & a separate data set for each select query? If thats possible then how?
6
1691
by: ALI-R | last post by:
Hi All; I'm reading the following xml file into a Dataset but there are only 4 datatables in my dataset (which should be 5) Is that because I have two nodes with the same name (detail) in my xml file? how can I fix this? Thanks for your time. <?xml version="1.0" ?>
0
12088
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
5
2666
by: Kent Boogaart | last post by:
Hi, I have some hierarchical data (FAQs) that I would like to bind to. The basic structure is: FAQ Category + Categories + FAQs So an FAQ category has any number of sub-categories and any number of FAQs.
1
2101
by: David Veeneman | last post by:
How do I get the data bindings for a control that is bound at design time? I'm binding a DataGridView control to a data source at design time, using a BindingSource control. I set the grid's DataSource property to the BindingSource control, which the Data Source Configuration Wizard created for me. The data binding works fine when I run the app, but I can't get a reference to the DataGridView's data bindings.
1
15553
by: theeverdead | last post by:
Ok I have a file in it is a record of a persons first and last name. Format is like: Trevor Johnson Kevin Smith Allan Harris I need to read that file into program and then turn it into a linked list. So on the list I can go Trevor, Kevin, Allan in a straight row but I can also call out there last name when I am on their first name in the list. Sorry if it doesn't make sense trying to explain best I can. So far I have // list.cpp
21
3066
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z 00000000_00 0 000 000 000 0000 000 I need to read the file line by line and eventually parse out each piece of the file and store in arrays that correspond to the specific
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.