I saw on a few posts that ppl were trying to do the opposite, but I want a datagrid which grabs data from an Xml file/string and fill a dataset which is binded to the datagrid.
Could you guys supply me with a Xml & Code Example? Thanks.
blah blah blah is here! blah blah » Close
1 answers
Are u talking about a desktop application or ASP.NET application. Anyway i think u can do this simply be getting data from the XML file in a Dataset or datatable and then using it as a datasource for the datagrid.
answered 2 years ago by:
0
From your toolbar add DataSet in your form.. Then in your code write:
dataSet1.ReadXml("c:\\myXmlFile.xml"); //Read your XML
dataGrid1.DataSource = dataSet1; //View it in your DataGrid
Good Luck!
answered 2 years ago by:
0
http://msdn.microsoft.com/msdnmag/issues/02/02/data/default.aspx
answered 2 years ago by:
0
Could someone give me an example of what the Xml string/file would look like? I have tryed this with datasets and I don't get the little plus sign.. (ASP.NET APPS --YES!!)
answered 2 years ago by:
0
Try this XML File:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Library>
<Book>
<Title>Egyptian Civilization</Title>
<ISBN>120-293-114</ISBN>
<Author>Nagib Mahfouz</Author>
<Copies>20</Copies>
</Book>
</Library>
The "+" sign will be appear.. don't worry!!
Good Luck!
answered 2 years ago by:
0
<Insert frustration icon here>
I have tryed your suggestions, but to no avail:
[Xml]
<?xml version="1.0" encoding="ISO-8859-1"?>
<Library>
<Book>
<Title>Egyptian Civilization</Title>
<ISBN>120-293-114</ISBN>
<Author>Nagib Mahfouz</Author>
<Copies>20</Copies>
</Book>
</Library>
[C#]
DataSet ds1 = new DataSet();
ds1.ReadXml(@"D:\xmlStr.xml");
datG.DataSource = ds1;
datG.DataBind();
The datagrid fills the columns automattically, but the plus sign doesn't appear. Again, I am trying to do this with a WEB APP! (ASP.NET)
answered 2 years ago by:
0
Can you post the underlying Dataset, or just one field in it. Originally, I was thinking that you were using the wingrid, but let me see at least one record and we can work something out. I've done a fair amount of ASP.NET, and to the best of my knowledge, I don't think the web grid natively supports it out of the box. When I get in the office tomorrow though, let me look through a few things.
I'll be in touch shortly.
Cheers,
Bill
answered 2 years ago by:
0
What exactly do you mean "underlying Dataset?" I already posted the entire code to the project... Thanks for your help in any event.
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!