Hi there,
I'm trying to generate xml from the datasource of rad gridview. Following is how I'm binding data to the grid:
radgvParticulars.MasterGridViewTemplate.DataSource = dsTODetails.Tables[1];
I'm wrote the following code to extract the xml from the datasource:
DataSet ds = (DataSet)radgvParticulars.DataSource;
string strXml = ds.GetXml();
This throws an InvalidCastException - "Unable to cast DataTable object to DataSet object". Then I tried the same by writing the below code:
DataTable dt = new DataTable();
dt = (DataTable)radgvParticulars.DataSource;
DataSet dsnew = new DataSet();
dsnew.Tables.Add(dt);
string strXml = dsnew.GetXml();
But this throws another exception: "DataTable already belongs to another DataSet".
I'm unable to proceed further. Pls help.
Regards,
Pramod Goutham.
I'm trying to generate xml from the datasource of rad gridview. Following is how I'm binding data to the grid:
radgvParticulars.MasterGridViewTemplate.DataSource = dsTODetails.Tables[1];
I'm wrote the following code to extract the xml from the datasource:
DataSet ds = (DataSet)radgvParticulars.DataSource;
string strXml = ds.GetXml();
This throws an InvalidCastException - "Unable to cast DataTable object to DataSet object". Then I tried the same by writing the below code:
DataTable dt = new DataTable();
dt = (DataTable)radgvParticulars.DataSource;
DataSet dsnew = new DataSet();
dsnew.Tables.Add(dt);
string strXml = dsnew.GetXml();
But this throws another exception: "DataTable already belongs to another DataSet".
I'm unable to proceed further. Pls help.
Regards,
Pramod Goutham.