This is a migrated thread and some comments may be shown as answers.

Dynamic column exported in Excel as System.Data.DataRowView

1 Answer 419 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mehmet
Top achievements
Rank 1
Mehmet asked on 09 Jul 2015, 04:13 AM

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

1 Answer, 1 is accepted

Sort by
0
Mehmet
Top achievements
Rank 1
answered on 09 Jul 2015, 04:29 AM
No need to reply. I have solved the issue.
Tags
Grid
Asked by
Mehmet
Top achievements
Rank 1
Answers by
Mehmet
Top achievements
Rank 1
Share this question
or