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

Expanded Hierarchical Grid to Excel with Ignore Paging

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Claire Thomson
Top achievements
Rank 1
Claire Thomson asked on 13 May 2010, 03:04 PM
I have a Hierarchical  grid which I want to export to Excel, this works fine but I would like to ignore the paging, but in doing so it will only print the details of the parent grid - am I missing something?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 14 May 2010, 11:41 AM
Hello Claire,

The expanded items will collapse automatically when RadGrid rebinds in order to fetch all items from your datasource (IgnorePaging)

For your convenience I attached a sample project that demonstrate how to persist the expanded items manually.

Best regards,
Daniel
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Claire Thomson
Top achievements
Rank 1
answered on 14 May 2010, 12:24 PM
Excellent thanks, that will come in handy if I need to remember which items were expanded!
I had to have all expanded at time of export - so my quick solution was
protected void Button1_Click(object sender, System.EventArgs e) 
        { 
            OrdersGrid.MasterTableView.HierarchyDefaultExpanded = true
            OrdersGrid.PageSize = 100
            OrdersGrid.MasterTableView.Rebind(); 
 
            foreach (GridDataItem item in OrdersGrid.MasterTableView.Items) 
            { 
                if (item.Expanded) 
                { 
                    foreach (GridTableView childTable in item.ChildItem.NestedTableViews) 
                    { 
                        childTable.ForeColor = System.Drawing.Color.Green; 
 
                        foreach (GridHeaderItem header in childTable.GetItems(GridItemType.Header)) 
                        { 
                            header.Visible = true
                        } 
                    } 
                } 
            }  
 
            //ConfigureExport(); 
 
            OrdersGrid.ExportSettings.ExportOnlyData = true
            OrdersGrid.MasterTableView.ExportToExcel(); 
        } 
Tags
Grid
Asked by
Claire Thomson
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Claire Thomson
Top achievements
Rank 1
Share this question
or