I added 89 textboxes dynamically. I want to get the value of the textboxes to xml. I can add the textboxes just fine the problem is I cant get the values on those dynamically added textboxes.
For example i want to get value from textBox1 to the node "F1" in XML ,from textBox2 to node "F2" in XML.
private void button1_Click(object sender, EventArgs e)
{
XmlNodeList xnList;
XmlDocument doc = new XmlDocument();
string dosyayolu = Application.StartupPath + "\\coupling.xml";
doc.Load(dosyayolu);
if (globaller.hangimenu == "TWT1")
{
xnList = doc.SelectNodes("/coup/TWT1");
}
else
{
xnList = doc.SelectNodes("/coup/TWT2");
}
for (int i = 0; i < 89; i++)
{
foreach (XmlNode xn in xnList)
{
xn["F" + (i + 1).ToString()].InnerText = "k";
// xn["F1"].InnerText = textBox1.Text;
}
}
doc.Save(dosyayolu);
}
No comments:
Post a Comment