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

[Solved] export paginated radgrid with some expanded detailtables problem

4 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 12 Nov 2009, 08:33 AM
hi I have a radgrid with 3 detailtables on the 2nd level and each detail table also has a 3rd level detail table. The mastertableview grid is paginated, on the export button click I have the following code to export the grid with expanded detailtables (some mastertable records are expanded, some are not):

protected

 

void ExportData(object sender, EventArgs e)

 

{

 

Button ExportLinkButton = (Button)sender;

 

RadGrid1.ExportSettings.IgnorePaging =

false;

 

RadGrid1.MasterTableView.ExportToExcel();

}

 


At runtime I only expanded one mastertableview record, and the detail table for this record is exported correctly. However I realised that only 1st page of the mastertable grid is exported... Then I tried to add the follwoing line of code and expecting to fix the issue:

RadGrid1.MasterTableView.AllowPaging =

false;

 


Then at runtime it does export all records in the mastertable, however the expanded detail tables are no longer shown..

is there anything missing in my code? please help
thanks in advance!



4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Nov 2009, 10:29 AM
Hello sf,

You can try out the following code instead:
c#:
protected void ExportData(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.HierarchyDefaultExpanded = true
        RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true
        RadGrid1.AllowPaging = false
        RadGrid1.Rebind();         
        RadGrid1.ExportSettings.OpenInNewWindow = true ;         
        RadGrid1.MasterTableView.ExportToExcel(); 
    } 

Thanks
Princy.
0
sf
Top achievements
Rank 1
answered on 13 Nov 2009, 01:25 AM
thanks Princy, with your help i was able to export everything in the grid with all detail tables, however all records are expanded, which wasn't expected. I only want to export the expanded detail tables, not all of them... e.g. I only expanded 1st row in the master table, then in the export i only want to see the entire mastertable and the detail table of the 1st master table record.
0
sf
Top achievements
Rank 1
answered on 08 Feb 2010, 07:03 AM
still couldnt solve this issue, can I get more help please
0
Daniel
Telerik team
answered on 10 Feb 2010, 06:41 PM
Hello,

You should manually persist the expanded items in some way. For your convenience I created a sample project that might give you some ideas.

Regards,
Daniel
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Grid
Asked by
sf
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
sf
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or