1

At present I’m developing a registration form in which, when we click on the save button. It will get save in a xml file. The details in the xml file should be displayed in the datagrid in separate window form. There are also three buttons. Edit, new and delete. On clicking on edit button, the selected rows detail in gridview should display in the registration form. I don’t know how to do this.

By selecting a row, when we click on delete button , it should delete that particular record from the xml file. This also I’m not getting……….. please help me………………………………..

Regards,

Manikandan.S

4
  • Show us what have you done so far.
    – Shoban
    Sep 14, 2009 at 12:09
  • 3
    Homework or training document ?
    – MRG
    Sep 14, 2009 at 12:10
  • Some further details could help. Sep 14, 2009 at 12:14
  • 4
    is that Morse code there at the end? :-)
    – Wim Coenen
    Sep 14, 2009 at 12:27

4 Answers 4

6

This is readymade example By Zubair Ahmed and Scott Mitchell. It displays and explains Editing of XML file with the use of Grid. I think this is what you need.

https://web.archive.org/web/20210513223010/http://aspnet.4guysfromrolla.com/articles/112603-1.aspx Edit xML with Grid

3
  • You should've pasted the link as let google that for you. Hehe
    – Raúl Roa
    Sep 14, 2009 at 12:22
  • :) Exactly mate.. It was just second result. Now let me correct it. So Let me google that for you (lmgtfy.com/?q=asp.net+grdivew+add%2Cupdate%2Cdelete+in+xml).
    – MRG
    Sep 14, 2009 at 12:24
  • Of course is the second result. The first result is this question!
    – Raúl Roa
    Sep 14, 2009 at 12:52
2

Choose DataSet class.

SUMMARY:

A DataSet can read and write data and schema as XML documents. The data and schema can then be transported across HTTP and used by any application, on any platform that is XML-enabled. You can save the schema as an XML schema with the WriteXmlSchema method, and both schema and data can be saved using the WriteXml method. To read an XML document that includes both schema and data, use the ReadXml method.

In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in turn, updating the original data are to:

  1. Build and fill each DataTable in a DataSet with data from a data source using a DataAdapter.
  2. Change the data in individual DataTable objects by adding, updating, or deleting DataRow objects.
  3. Invoke the GetChanges method to create a second DataSet that features only the changes to the data.
  4. Call the Update method of the DataAdapter, passing the second DataSet as an argument.
  5. Invoke the Merge method to merge the changes from the second DataSet into the first.
  6. Invoke the AcceptChanges on the DataSet. Alternatively, invoke
    RejectChanges to cancel the changes.
2

Why don't you use a serializeable object then you can work with an object in your form and whenever you want you can serialize it to a file or into a db field. There's a utility called XSD.exe that lets you build a serializeable object model from a xml.

0

I guess this is what you want to do at the end. XML - Insert/Update/Delete/Query

Hope this helps! Please let me know!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.