I have this small snippet below and i want to save some data back to the xml
file.
So i looked for a node and checked if the node value is the same as a
textbox value
and if yes i pass in the new value entered from a textbox back t the xml
datasource.
I'm populating values of the textboxes from an xml dtrasource
But it doesn't see to work am i missing something
Thanks in advance
string g = bbW;
if (node["Weighting"].InnerText == Weighting.Text)
{
node["Weighting"].InnerText = g;
}
-------------------------------------------------
code below
public void saveXmlData(string bbW)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(Server.MapPath("WT.xml"));
XmlNodeList nodeList = xmlDocument.SelectNodes("//WeightingsRep");
foreach (XmlNode node in nodeList)
{
//Response.Write("todd:" + bbW);
string g = bbW;
if (node["Weighting"].InnerText == Weighting.Text)
{
node["BBWeighting"].InnerText = g;
}
}
xmlDocument.Save(Server.MapPath("WT.xml"));
xmlDocument = null;
}