To summarize what I am attempting to do, I am attempting to export data items from a RadListView (databound) to Excel using a RadGridview and RadGridViewExcelExporter.
This is actually a 2-part issue:
The first issue involves populating with data the RadGridView object that is passed to the RadGridViewExcelExporter (see below).
myDataSet.joberrors is the datasource of my RadListView and contains 2 rows and 14 columns. Using the above code, myGridView contains 0 rows and 0 columns even after the datasource is set.
To solve this I used
now myGridView is successfully populated with data, but the second problem now rears its head...
After exporting the data to Excel using the RadGridViewExcelExporter , the exported worksheet only contains one column - the primary key of myDataSet.joberrors?.
Any ideas what I am doing wrong? Is there an easier way to do this?
Thanks
This is actually a 2-part issue:
The first issue involves populating with data the RadGridView object that is passed to the RadGridViewExcelExporter (see below).
void
Export_to_Excel(String myExcelFile)
{
RadGridView myGridView =
new
RadGridView();
myGridView.DataSource = myDataSet.joberrors;
RadGridViewExcelExporter exporter =
new
RadGridViewExcelExporter();
exporter.Export(myGridView, myExcelFile,
"Sheet1"
);
exporter =
null
;
myGridView =
null
;
}
myDataSet.joberrors is the datasource of my RadListView and contains 2 rows and 14 columns. Using the above code, myGridView contains 0 rows and 0 columns even after the datasource is set.
To solve this I used
myGridView.LoadFrom(myDataSet.joberrors.CreateDataReader());
now myGridView is successfully populated with data, but the second problem now rears its head...
After exporting the data to Excel using the RadGridViewExcelExporter , the exported worksheet only contains one column - the primary key of myDataSet.joberrors?.
Any ideas what I am doing wrong? Is there an easier way to do this?
Thanks