I assign values from the query string to these text fields, and it works fine, but whenever I edit the text in one of them and try to save the edited data in an XML node, I cannot
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString != null) { TextBox_firstname.Text = Request.QueryString["column1"]; TextBox_lastname.Text = Request.QueryString["column2"]; } else { } }
Is there anything with this code? It saves the unedited version in nodes!
public string str_id; public int id; id = int.Parse(str_id); XDocument xdoc = XDocument.Load(filepath); if (id == 1) { var StudentNodeWithID1 = xdoc.Descendants("students") .Elements("student") .Where(s => s.Element("id").Value == "1") .SingleOrDefault(); StudentNodeWithID1.Element("first_name").Value = TextBox_firstname.Text; StudentNodeWithID1.Element("last_name").Value = TextBox_lastname.Text; }
source share