Export to Excel Missing Column Header Names

4 posts, 0 answers
  1. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 15 Dec 2014 Link to this post

    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? 
  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 18 Dec 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Logan
    Logan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 29 Dec 2014 in reply to Eyup Link to this post

    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
  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 31 Dec 2014 Link to this post

    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.

     
Back to Top