title: Getting Data to add correctly from ASP.Net to XML so it displays correctly in Grid view
body: <p>Soo relatively new here and having a tad bit of an issue with my coding:</p>
  
  <p>Here's what i got so far to work with:</p>
  
  <pre><code>PurchaseCollection&gt;
    &lt;purchases CustomerId="1" fullName="Jareth Baxter" 
  emailAddress="jareth.baxter@gmail.com" productName="Product 1" 
  unitPrice="12.50" quantity="5" /&gt;
  </code></pre>
  
  <p>
    
    </p>
  
  <p>Now this works perfectly for my grid view, however I cannot for the life of me get the add record to action the record in the same way</p>
  
  <p>So basically, the above displays as a grid view on the main ASP.Net form I've built - However I need to make a second form that adds the data accordingly to the XML sheet in question.</p>
  
  <p>Here's a snippet code I tried, but didn't work as intended.</p>
  
  <pre><code>XmlDocument XmlDocObj = new XmlDocument();
          XmlDocObj.Load(Server.MapPath("/Data/purchases.xml"));
          XmlNode RootNode = 
  XmlDocObj.SelectSingleNode("PurchaseCollection");
  PurchasesNode.AppendChild(XmlDocObj.CreateNode(XmlNodeType.Element, 
  "fullName", "")).InnerText = fullName.Text;
   RootNode.AppendChild(XmlDocObj.CreateNode(XmlNodeType.Element, 
  "emailAddress", "")).InnerText = emailAddress.Text;
      RootNode.AppendChild(XmlDocObj.CreateNode(XmlNodeType.Element, "productName", "")).InnerText = productName.Text;
      RootNode.AppendChild(XmlDocObj.CreateNode(XmlNodeType.Element, "unitPrice", "")).InnerText = unitPrice.Text;
      RootNode.AppendChild(XmlDocObj.CreateNode(XmlNodeType.Element, "quantity", "")).InnerText = quantity.Text;
      XmlDocObj.Save(Server.MapPath("/Data/purchases.xml"));
  </code></pre>
  
  <p>Any advice would be awesome! (Please note: I'm not asking to be led on a tangent of .js or SQL as this is for a uni assignment, however i'm stuck on where i can word this one)</p>
  
  <p>Essentially the outcome should look like this:
  <a href="https://i.stack.imgur.com/Bu6hM.png" rel="nofollow noreferrer">Main Index page</a>
  HOWEVER: when it works - the code ends up create new block of xml code instead of attributed group</p>