Here is demo file xml and picture demo.
Collapse | Copy Code
-
-
1111 -
English -
2$ -
-
222 -
USA -
3$ -
-
3333 -
Singapore -
4$
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 18, 2012, 1:39 PM EST
This LINQ to XML code should do it:
using System;
using System.Linq;
using System.Xml.Linq;
class Test
{
static void Main()
{
XElement data = XElement.Load("demo.xml");
XElement searchBook = data.Elements("book").Where(book => book.Element("bookID").Value == "1111").FirstOrDefault();
if(searchBook != null)
{
searchBook.Element("bookPrice").Value = "1$";
data.Save("demo.xml");
}
}
}
Maria Bili34 reputationPosted Nov 18, 2012, 2:06 PM EST
In this I think we a get value from textbox node/element value and transmit it to bookID and after that fill new value of bookName and change ? some one have some opinon ?
VulpesRank #55 · 29.2K reputationPosted Nov 18, 2012, 2:42 PM EST
The code for the button Click eventhandler will be something like this:
Maria Bili34 reputationPosted Nov 18, 2012, 5:10 PM EST