Remove Header Columns when export to excel and CSV

8 posts, 0 answers
  1. bharat veer
    bharat veer avatar
    41 posts
    Member since:
    Dec 2009

    Posted 12 Aug 2011 Link to this post


    we have a radgrid and we are binding the radgrid with datatable the grid height and width is "0px" while we export to excel or csv we want to remove its header column name is there any possiblities to remove this? Below is my code :

    //HTML code
    <telerik:RadGrid ID="rgExport" runat="server" Height="0" Width="0"

    //.CS file Code

    please reply soon we will very thankful to you.

    thanks & regards
  2. Daniel
    Daniel avatar
    4949 posts

    Posted 15 Aug 2011 Link to this post

    Hello Bharat,

    You can remove the header row by setting ShowHeader to false. Simple demo is shown below:
    <asp:Button ID="Button1" runat="server" Text="Export" />
    <telerik:RadGrid ID="RG1" runat="server" />

    protected override void OnInit(EventArgs e)
        RG1.NeedDataSource += (s, a) =>
                DataTable table = new DataTable();
                for (int i = 0; i < 10; i++)
                    table.Rows.Add(i, i);
                RG1.DataSource = table;
        Button1.Click += (s, a) =>
            RG1.ShowHeader = false;

    Best regards,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. bharat veer
    bharat veer avatar
    41 posts
    Member since:
    Dec 2009

    Posted 17 Aug 2011 Link to this post

    Thanks Daniel !!!!! but it is only working for CSV. It is not working for Excel. Can you please provide me solution for excel as well as. Please reply soon.
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Aug 2011 Link to this post

    Hello Bharat,

    You can try the following code snippet to achieve your scenario.

    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
          if (e.CommandName == RadGrid.ExportToExcelCommandName)
              GridHeaderItem HeaderItem = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0];

  5. Rasheed
    Rasheed avatar
    3 posts
    Member since:
    Sep 2014

    Posted 06 Nov 2014 Link to this post

    I want to remove the header of Detail Table.
    How can it possible.
    And moreover Itemcommand event is not firing when clicking on Export to Excel button.
  6. Eyup
    Eyup avatar
    3320 posts

    Posted 11 Nov 2014 Link to this post

    Hello Rasheed,

    I've created a sample RadGrid web site to demonstrate how you can achieve the requested functionality. Please run the attached application and let me know if it helps you.


    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.

  7. Jorge
    Jorge avatar
    2 posts
    Member since:
    Oct 2014

    Posted 25 Jul 2015 in reply to Eyup Link to this post


    Not work for me!

    Please see the picture. I need remove the header row for each DetailTables.

    I hope your help!

  8. Eyup
    Eyup avatar
    3320 posts

    Posted 30 Jul 2015 Link to this post

    Hi Jorge,

    Could you share your exporting settings and configuration so I can prepare a web site sample resembling your scenario?

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top