If you have a DataSet in your project that is populated from the data source that you have your Grid set to you can do this. I'm using a SQL data base and created a dummy DataSet called DataSet1 which is linked to databaseTable which is the table in my database. From here I just created a button which had this code-behind:
databaseTableTableAdapter m = new databaseTableTableAdapter();
DataSet1.databaseTableDataTable dt = new DataSet1.databaseTableDataTable();
m.Fill(dt);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
ds.WriteXml(Server.MapPath("~/myFile.xml"));
}
Here you see that I simply set up a TableAdapter and a DataTable and filled the DataTable. Once this is filled I added it to the DataSet. And DataSet objects have the function WriteXml that takes a string which is the file name of the .xml file you want to write to. Hopefully this helps!