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

[Solved] Can't Export Child Records from Hierarchical Grid

2 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 10 Jul 2009, 10:54 PM

Hi,

I can't seem to export the child records.  I have 3 levels of hierarchical grid.

Here is the code that I'm using:

RadGrid1.ExportSettings.ExportOnlyData = True

 

RadGrid1.ExportSettings.IgnorePaging =

True

 

RadGrid1.ExportSettings.OpenInNewWindow = True

 

 

RadGrid1.ExportSettings.FileName = "Summary_" & Now.Date.ToShortDateString.Replace("/", "")

 

RadGrid1.MasterTableView.HierarchyDefaultExpanded =

True

 

RadGrid1.MasterTableView.ExportToExcel()

I've tried using Rebind()  method as well but that didn't really solve my problem.  I'm only seeing 2 levels only.

Please help!

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2009, 07:17 AM
Hi Tom,

Give a try with the following approach to export the hierarchical Grid Data.

CS:
 
 
    protected void Button2_Click(object sender, EventArgs e) 
    { 
        RadGrid2.ExportSettings.ExportOnlyData = true
        foreach(GridDataItem item in RadGrid2.MasterTableView.Items ) 
        { 
            item.Expanded = true
            if (item.Expanded) 
            { 
                GridTableView childTable = (GridTableView)item.ChildItem.NestedTableViews[0]; 
                foreach (GridDataItem chilItem in childTable.Items) 
                { 
                    chilItem.Expanded = true
                } 
            } 
        } 
    
        RadGrid2.MasterTableView.ExportToExcel(); 
    } 
 


Thanks
Shinu.
0
Tom
Top achievements
Rank 1
answered on 13 Jul 2009, 01:48 PM
Thank you, that worked!
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Tom
Top achievements
Rank 1
Share this question
or