Export Datagrid to an xml
<p>Please help me to export a DataGrid to XML.
I tried two ways but both cause exceptions to be thrown.</p>

<pre><code>DataTable dt = (DataTable)dataGrid2.DataSource;
dt.WriteXml("t.xml", XmlWriteMode.IgnoreSchema);
</code></pre>

<p>This throws an InvalidOperationException with message "Cannot serialize the DataTable. DataTable name is not set." </p>

<p>Please recommend a suitable method to export a datagrid to XML.</p>
