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

How would that be possible to hide the nested table headers when exporting?

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooya
Top achievements
Rank 1
Pooya asked on 20 Jul 2011, 10:05 AM
I have a RadGrid with nested tables and I have set the ShowHeader of the nested tables to false.

However, at the time of exporting, the headers are displayed.

How would that be possible to hide the nested table headers when exporting to Excel, Word and Pdf?

Many thanks,

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jul 2011, 11:43 AM
Hello Pooya,

Try the following approach to achieve your scenario.
C#:
bool isExport = false;
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item.OwnerTableView.Name == "Detail" && isExport)
        {
            if (e.Item is GridHeaderItem)
            {
                GridHeaderItem hitem = (GridHeaderItem)e.Item;
                hitem.Visible = false;
            }
        }
    }
 protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.ExportToExcelCommandName)
        {
            RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
            isExport = true;
            RadGrid1.Rebind();
        }  
    }

Thanks,
Shinu.
Tags
Grid
Asked by
Pooya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or