Hi
In my application I try to add one row from datagrid into datatable and I
recive the following message:
Exception Details: System.ArgumentException: This row already belongs to
another table.
The part of code that realize this procedure look:
private void dg1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataSet ds1 = new DataSet();
string xmlPath;
xmlPath = Server.MapPath("")+"\\ds.xml";
ds1.ReadXml(xmlPath);
DataTable dt = new DataTable();
DataRow dr;
dr = ds1.Tables["person"].Rows[dg1.SelectedIndex];
dt.NewRow();
dt.Rows.Add(dr);
// error occur in this line dg2.DataSource=dt;
dg2.DataBind();
}
Dataset is in xml file and one of tables "person" is binded with dg1
datagrid and I clik into select column of this datagrid for run
dg1_SelectedIndexChanged
I need help
thnks
Bobo