sachi vasishta

sachi vasishta

  • NA
  • 252
  • 0

How to write to\delete from XML file from textboxes in asp.net

Dec 5 2011 1:10 AM
Hi All,

I have a following XML file(auto.xml)

<root>
 <fault>
  <text selected value="Pending Fault">Pending Fault found on</text>
  <text selected value="Already Repaired">Repaired Fault on</text>
  // the value entered in textboxes should be written here
 </fault>
</root>


in aspx page I have 2 textboxes and a button. Suppose I enter 'Checking fault on' in first textbox and 'Already checked' in second textbox and click on the add button, then the first value should be added as the third node value and the second textbox value should be added as the attribute value.

i.e., the xml file should look like this

<root>
 <fault>
  <text selected value="Pending Fault">Pending Fault found on</text>
  <text selected value="Already Repaired">Repaired Fault on</text>
  <text selected value="Already checked">Checking Fault on</text>
 </fault>
</root>


And also how to delete that node from XML ? i.e., if I click on delete button then that node should be removed from the XML file.

Thanks,
Sachi


Answers (4)