Adding,Deleting and modifying the xml file using asp.net tree view control
by gugan » Thu, 08 Jan 2009 14:06:25 GMT
In my project i have a requirement of using the xml file to create the tree view control. I have problem in deleting the elements of the xml file.
can anyone suggest a solution for this.
Thanks in advance!!!
EggHeadCafe - .NET Developer Portal of Choice
http://www.**--****.com/
Re: Adding,Deleting and modifying the xml file using asp.net tree view control
by Anthony Jones » Thu, 08 Jan 2009 18:33:57 GMT
Use System.Xml.XmlDocument. Load file into object with Load method.
Use SelectSingleNode with XPath to find the element you wish to delete.
XmlNode elemToDelete = dom.SelectSingleNode("xpath here");
elemToDelete.ParentNode.RemoveChild(elemToDelete);
--
Anthony Jones - MVP ASP/ASP.NET