Assuming your root element
employee
exists on the XML file, there would be a problem on your code, since
myxmlnode
will always point to null if your root node does not have child elements at the moment. You can probably edit the way you assign the value like this.
XmlNode myxmlnode = myxmldocument.DocumentElement;
And then, you can then add child nodes to your root node(employee) like this.
XmlElement myXmlElement = myxmldocument.CreateElement("Name");
myXmlElement.InnerText = Server.HtmlEncode(TextBox1.Text);
myxmlnode.AppendChild(myXmlElement);