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

Export to excel with manualy added columns

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dmajkic
Top achievements
Rank 2
dmajkic asked on 12 Sep 2008, 09:13 PM

I am dynamicly creating foo columns to be added to the grid

I do it like this in Page_Load:

foreach
(Artikli artikal in a)
{
    GridNumericColumn gridColumn = new GridNumericColumn();

    this.RadGrid1.MasterTableView.Columns.Add(gridColumn);
    gridColumn.DataField =
"blank";
    gridColumn.HeaderText = artikal.Naziv;
    gridColumn.UniqueName = artikal.Id.ToString() +
"_blank";
    // gridColumn.Expression = " ";
}


Export in Excel (ML) will export existing columns and only first added column.
Excel html export exports all columns, but xls file looks better in excel. 
 
If I try to create GridCalculatedColumn instead of GridBoudCollumn, I rececive this error: 

GridException: Cannot create column with the specified type name: GridCalculatedColumn]
   Telerik.Web.UI.GridColumnCollection.CreateColumnFromTypeName(String columnTypeName) +1013
...
 
Any help?

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 15 Sep 2008, 12:45 PM
Hi dmajkic,

Can you please provide some more code for the setup of the control? Is it completely created in the code behind, or only the additional columns?

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
dmajkic
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Share this question
or