protected void btnNewRow_Click(object sender, EventArgs e) { DataSet myDset = ReadXMLDataSet(); //Check if table exist if (myDset != null && myDset.Tables.Count > 0) { //Copy the structue of row and fill data DataRow myDrow = myDset.Tables[0].NewRow(); myDrow["name"] = "Lap To"; myDrow["nationality"] = "US"; myDrow["movement"] = "What"; myDrow["birthdate"] = "Jan 1 2000"; //Add Row to datatable myDset.Tables[0].Rows.Add(myDrow); //Commit the changes myDset.AcceptChanges(); //Save the changes SaveXMLDataSet(myDset); PopulateGrid(); // refresh screen/gridview } } // read xml file private DataSet ReadXMLDataSet() { DataSet myFile = new DataSet(); string xmlFilename = Server.MapPath("~/App_Data/artists.xml"); myFile.ReadXml(xmlFilename); return myFile; } // save row back to xml file private void SaveXMLDataSet(DataSet dset) { string xmlFilename = Server.MapPath("~/App_Data/artists.xml"); if (dset != null) dset.WriteXml(xmlFilename); } private void PopulateGrid() { DataSet dSet = ReadXMLDataSet(); // quick check to make sure xml file not return empty data if (dSet != null && dSet.Tables.Count > 0 && dSet.Tables[0].Rows.Count > 0) { ian.DataSource = dSet; ian.DataBind(); } }