473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Link XML file to a datagrid

Hi there, I wonder if anyone can give me some help here?
I am a newbie at csharp, and am translating a C++ app that I wrote into
csharp.
What I have is a and XmlDocument in memory, referenced by a variable

m_loadedFile = new XmlDocument();

This is then loaded from an Xml file, whose structure looks something like
this (for brevity, I know this isnt fully formed!) :-

<top_level>
<something_0>
<level_1>
<level_2>
<field_1>data 1</field_1>
<field_2>data 2</field_2>
<field_3></field_3>
<field_4></field_4>
<field_5>data 5</field_5>
<field_6>data 6</field_6>
<field_7>data 7</field_7>
</level_2>
</level_1>
<level_1>
<level_2>
<field_1>data 1</field_1>
<field_2>data 2</field_2>
<field_3></field_3>
<field_4></field_4>
<field_5>data 5</field_5>
<field_6>data 6</field_6>
<field_7>data 7</field_7>
</level_2>
</level_1>
<something_0>
<something_1>
</something_1>
<something_2>
</something_3>
</top_level>

What I would like to do is link the level_1 data as rows in a datagrid, with
the field data becoming the cells in the datagrid. When I save the datagrid,
I woudl like the level_1 data updated ( I will then save the Xml document at
a later point)

I think that I have to setup datasets and the like, but after looking at
various sites such as codeguru, csharphelp etc, I am really confused! So any
help woudl really be appreciated.

Thanks in advance

Hugh
Nov 15 '05 #1
1 1363
Hugh,

You could load the XML into a dataset and bind a DataGrid control to that
dataset. The structure of your XML, however, seems to be not that easily
inferrable. Try DataSet.ReadXml with XmlReadMode.InferSchema, and if that
does not help, we will think of something else.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Hugh Creswell" <hu***********@baesystems.com> wrote in message
news:40********@baen1673807.greenlnk.net...
Hi there, I wonder if anyone can give me some help here?
I am a newbie at csharp, and am translating a C++ app that I wrote into
csharp.
What I have is a and XmlDocument in memory, referenced by a variable

m_loadedFile = new XmlDocument();

This is then loaded from an Xml file, whose structure looks something like
this (for brevity, I know this isnt fully formed!) :-

<top_level>
<something_0>
<level_1>
<level_2>
<field_1>data 1</field_1>
<field_2>data 2</field_2>
<field_3></field_3>
<field_4></field_4>
<field_5>data 5</field_5>
<field_6>data 6</field_6>
<field_7>data 7</field_7>
</level_2>
</level_1>
<level_1>
<level_2>
<field_1>data 1</field_1>
<field_2>data 2</field_2>
<field_3></field_3>
<field_4></field_4>
<field_5>data 5</field_5>
<field_6>data 6</field_6>
<field_7>data 7</field_7>
</level_2>
</level_1>
<something_0>
<something_1>
</something_1>
<something_2>
</something_3>
</top_level>

What I would like to do is link the level_1 data as rows in a datagrid, with the field data becoming the cells in the datagrid. When I save the datagrid, I woudl like the level_1 data updated ( I will then save the Xml document at a later point)

I think that I have to setup datasets and the like, but after looking at
various sites such as codeguru, csharphelp etc, I am really confused! So any help woudl really be appreciated.

Thanks in advance

Hugh


Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: scott | last post by:
Hi all First off, thank you for any one that can help. I have a problem trying to link a DataGrideTableStyle to a DataGrid. I have a dataset which reads from a file a xml schema and a xml...
2
by: Luis E Valencia | last post by:
I want a row of the datagrid with a personalized link. The fields of the link are on the select related to the datagrid the link would be accoiones.aspx?iddireccion=2&idindicador=5 I tried...
0
by: Luis E Valencia | last post by:
Read from above to top. I didnt understand. This is the code that fills that datagrid Public Sub pasar(ByVal sender As System.Object, ByVal e As...
2
by: Niclas Lindblom | last post by:
Hi, I have a datagrid with linkbuttons. I would like to catch the click event when a link button has been clicked and use the string from the text value of the link button in a clientside Java...
2
by: JenHu | last post by:
hi, I have a datagrid in my asp.net application, I am using vb.net language. I want to have my last column as a link column, link to text file. The link path is "c:\Temp\" & F_File_Name, which...
2
by: Bazza Formez | last post by:
Hi there, This must be simple I know... I have an ASP.NET web page with a datagrid on it. One of the template columns is a hyperlink that has a URL point to a PDF document... When the user...
6
by: Chris Kennedy | last post by:
I have a datagrid bound to a datareader. One of the columns contains file name. I would like a column which acts as a link and opens a link to the file (normally a pdf). How would I do this?
2
by: Bazza Formez | last post by:
Hello, In my aspx file I have a LinkButton inside a template column, inside a datagrid. I have assigned a CommandName to the button. In my code behind, I attempt to trap the command in the...
1
by: Mel | last post by:
I have a datagrid control that has one column displaying a filename. When the link is clicked it opens the file. How do I open a file that resides on a remote server? The code below does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.