473,378 Members | 1,441 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,378 software developers and data experts.

Binding and Editing XML Data (Urgent)

Hi,

Please help me as soon as possible for the following problem. It is very very urgent.

I have an XML file as follows:

<?xml version="1.0" standalone="yes"?>
<Employee>
<em name="Asha" id="1">
<details>456</details>
<details>897</details>
</em>
<em name="Siva" id="2">
<details>890</details>
<details>234</details>
</em>
<em name="Lekshmi" id="3">
<details>3768</details>
<details>777</details>
</em>
....

....

....

</Employee>



I am unable to bind these data in GridView.

Please help me to bind and edit these XML data using GridView Control or Repeater Control.

It is very urgent.


Thanks in Advance,

Regards,

Asha Sivan
Aug 10 '07 #1
4 1870
dip_developer
648 Expert 512MB
Hi,

Please help me as soon as possible for the following problem. It is very very urgent.

I have an XML file as follows:

<?xml version="1.0" standalone="yes"?>
<Employee>
<em name="Asha" id="1">
<details>456</details>
<details>897</details>
</em>
<em name="Siva" id="2">
<details>890</details>
<details>234</details>
</em>
<em name="Lekshmi" id="3">
<details>3768</details>
<details>777</details>
</em>
....

....

....

</Employee>



I am unable to bind these data in GridView.

Please help me to bind and edit these XML data using GridView Control or Repeater Control.

It is very urgent.


Thanks in Advance,

Regards,

Asha Sivan
convert your xml to a DataSet.....then bind DataSet with your DataGrid or GridView...

try this..............

Expand|Select|Wrap|Line Numbers
  1.  
  2. string myXMLfile = @"C:\myXMLFileName.xml";
  3.     DataSet ds = new DataSet();
  4.     // Create new FileStream with which to read the schema.
  5.     System.IO.FileStream fsReadXml = new System.IO.FileStream 
  6.         (myXMLfile, System.IO.FileMode.Open);
  7.     try
  8.     {
  9.         // Bind datagrid with dataset or gridview
  10.  
  11.         ds.ReadXml(fsReadXml);
  12.         dataGrid1.DataSource = ds;
  13.         dataGrid1.DataMember = "Cust";
  14.     }
  15.     catch (Exception ex)
  16.     {
  17.  MessageBox.Show(ex.ToString());
  18.     }
  19.     finally
  20.     {
  21.  fsReadXml.Close();
  22.     }
  23.  
Aug 10 '07 #2
Thanks for your reply.
Actually I want to edit the data also and it should be in ASP.NET.. not in C#
Aug 10 '07 #3
dip_developer
648 Expert 512MB
Thanks for your reply.
Actually I want to edit the data also and it should be in ASP.NET.. not in C#
Two things I have to say....
1.Firstly...you can make this datagrid editable......
look here...
http://www.megasolutions.net/kb/Edit..._DatagRid.aspx

2. secondly what do you mean by
it should be in ASP.NET.. not in C#??

do you know what you are saying actually????

ASP.net is a platform by which you can make an Application with an web user interface.......this application can be created with any language like vb/c#/j#...........I have written the code in C#.net......its my choice......you may write your code in vb.net.....but in any way the application is an ASP.net application.......

then what is the meaning of
it should be in ASP.NET.. not in C#??
Aug 10 '07 #4
I mean that I doing a web application. So the gridview control from asp.net have to use. Not for the windows application.

And also I know that GridView can be made editable. My problem is if I am having same tag then I am unable to bind it.

<?xml version="1.0" standalone="yes"?>
<Employee>
<em name="Asha" id="1">
<details>456</details>
<details>897</details>
</em>
<em name="Siva" id="2">
<details>890</details>
<details>234</details>
</em>
<em name="Lekshmi" id="3">
<details>3768</details>
<details>777</details>
</em>
....

....

....

</Employee>

here in this file there are more than 1 details tag. If it is only one is there, I am able to bind and edit data. But the problem is more than 1 tag with same name.


I think you understand my problem.

Asha Sivan
Aug 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
3
by: TS | last post by:
when binding to a datagrid for example, is it possible to use databinding syntax to bind to a property of a property? Say the datasource="Cars" which is a collection of car classes and the...
8
by: AG | last post by:
ASP.NET 2.0, VS 2005 I have a gridview with paging enabled, bound to an objectdatasource. Both were dropped on to the page and configured via the wizards. Basically working as expected. The...
3
by: cpnet | last post by:
I have a GridView which I'm populating from an ObjectDataSource (give the GridView a DataTable). The GridView will have about 20 rows, and only one editable column. The editable column consists...
6
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I am having trouble with the binding of a check box. I have a form for editing and adding reps. I am using a bindingsource and a bindingnavigator. I have on the form an "Active" checkbox, which...
9
by: =?Utf-8?B?VGVycnk=?= | last post by:
Think it is great the way that you can set up a datsource, value member, and display member for a combobox, and map a 'code' to a 'description' and back again by binding the combobox to a...
5
by: =?Utf-8?B?VGVycnk=?= | last post by:
Hi, I have a couple of labels on a form and their visible property is bound to boolean properties on a custom object. When I first load the form, all works as it should. This form is 'tied'...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
1
by: Ken Fine | last post by:
I have set up Microsoft Search Server 2008 Express. I want to know how I can query against it and return results in a form that can be bound to ASP.NET controls like ListViews. If there's simply...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.