472,358 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 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 1800
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...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.