Please help me to export a DataGrid to XML. I tried two ways but both cause exceptions to be thrown.
DataTable dt = (DataTable)dataGrid2.DataSource; dt.WriteXml("t.xml", XmlWriteMode.IgnoreSchema);
This throws an InvalidOperationException with message "Cannot serialize the DataTable. DataTable name is not set."
Please recommend a suitable method to export a datagrid to XML.