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

Export to Excel Missing Column Header Names

3 Answers 168 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Logan Marshall
Top achievements
Rank 2
Iron
Logan Marshall asked on 15 Dec 2014, 08:40 PM
When I do the export to excel function its missing header name (first row in excel).  I'm dynamically renaming these columns in the page load event.  Could that be why? 

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 18 Dec 2014, 11:43 AM
Hello Logan,

It is a possibility. I've created a sample RadTreeList web site to test the described behavior. Can you please run the attached application and instruct me the exact steps I need to follow in order to reproduce the issue?

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Logan Marshall
Top achievements
Rank 2
Iron
answered on 29 Dec 2014, 03:18 PM
Hello, Thank you so much for the example.  Can you try to rename column names on Page_Load and see if the export to Excel works?
Thanks so much
0
Konstantin Dikov
Telerik team
answered on 31 Dec 2014, 10:11 AM
Hello Logan,

I have tested the sample that Eyup have provided in his reply, where I am changing the column names in the Page_Load event handler, but with auto-generated column, this will not have any effect at all. With auto-generated column, the column name and the header text will be automatically generated, depending on the underlying data field and for changing the names, the server-side OnAutoGeneratedColumnCreated should be handled and the HeaderText property must be set and not the UniqueName property:
protected void RadTreeList1_AutoGeneratedColumnCreated(object sender, TreeListAutoGeneratedColumnCreatedEventArgs e)
{
    TreeListColumn column = e.Column;
    //column.UniqueName = "Test " + column.UniqueName;
    column.HeaderText = "Test " + (column as TreeListDataColumn).DataField;
}

In scenarios where the columns are defined in the markup, the Page's Load event could be used as shown below:
protected void Page_Load(object sender, EventArgs e)
{
    foreach (TreeListColumn column in RadTreeList1.RenderColumns)
    {
        column.HeaderText = "Test " + (column as TreeListDataColumn).DataField;
    }
}

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeList
Asked by
Logan Marshall
Top achievements
Rank 2
Iron
Answers by
Eyup
Telerik team
Logan Marshall
Top achievements
Rank 2
Iron
Konstantin Dikov
Telerik team
Share this question
or