Hi there,
I do need to create 3 new columns dynamically according to the data existence in the database. This approach has been done successfully and it works very well.
The issue occurs once the user clicks on the export button and the header does disappear and the data appears as "System.Data.DataRowView" in the excel sheet.
The following event is to load the grid. I do need to create programmatically, because I have to rename the column header according to the data that I receive.
//Add in name column
GridBoundColumn col =
new
GridBoundColumn();
col.HeaderText = addition1;
col.DataField =
"Additional1"
;
col.UniqueName =
"Additional1"
;
// col.Display = false;
RadGrid1.MasterTableView.Columns.Add(col);
col =
new
GridBoundColumn();
col.HeaderText = addition2;
col.DataField =
"Additional2"
;
col.UniqueName =
"Additional2"
;
// col.Display = false;
RadGrid1.MasterTableView.Columns.Add(col);
col =
new
GridBoundColumn();
col.HeaderText = addition3;
col.DataField =
"Additional3"
;
col.UniqueName =
"Additional3"
;
//col.Display = false;
RadGrid1.MasterTableView.Columns.Add(col);
So, after the above code, I do create a Data Table and bind the data in it and bind the Data Table in RadGrid.DataSource.
The look of the grid is okay. That means the column and the data are appearing perfectly.
However, once it comes on the excel file, the column text disappears and the content for these columns are appearing as "System.Data.DataRowView"
What could be the reason? - Thank you