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

Hierarchial grid Export to Excel Problem

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 15 Jul 2011, 01:05 PM
Hi there,

Iam using a Rad grid which has three hierarchial levels when iam trying to export data to excel it is exporting only parent data not the child data on searching of forums i found like hierarchyDefaultexpanded=true in source page with this onpage load the first level of the child getting expanded and on exporting it is sending the data with the first child only not the remaining two childs.What i want is like on page load the child shouldn't be expanded and on click of export button all childs must be exported.Here is the code iam using
gviewFormBlok.MasterTableView.HierarchyDefaultExpanded = true;
        gviewFormBlok.ExportSettings.ExportOnlyData = true;
        gviewFormBlok.ExportSettings.IgnorePaging = true;
         
          gviewFormBlok.ExportSettings.OpenInNewWindow = true;
  
        
          
  
          
        gviewFormBlok.MasterTableView.ExportToExcel();
Can you suggest me on how to achieve requirement and iam using Q3 2009 sp1 version

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 20 Jul 2011, 01:48 PM
Hello Prasad,

Please use the following code in order to expand the first and the second hierarchy level in export:
protected void Button1_Click(object sender, EventArgs e)
{
    RadGrid1.ExportSettings.IgnorePaging = true;
    RadGrid1.ExportSettings.ExportOnlyData = true;
    RadGrid1.MasterTableView.HierarchyDefaultExpanded = true; // for the first level
    RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true; // for the second level
    RadGrid1.MasterTableView.ExportToExcel();
}

I hope it helps.

All the best,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Prasad
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or