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

[Solved] export a radgrid with detail tables

2 Answers 408 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 14 Aug 2008, 11:21 AM
Hi,

Is it possible to export a radgrid with all the detail tables?  I can export the grid to excel but it wont take the detail tables with it.

I have a header row then 3 detail tables at the same level

thanks

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2008, 11:54 AM
Hi Paul,

Try setting the IgnorePaging property to true in the Export button Click event and see whether the detail tables are also getting exported.

CS:
 protected void Button1_Click1(object sender, EventArgs e) 
    { 
        RadGrid1.ExportSettings.IgnorePaging = true; 
        RadGrid1.ExportSettings.OpenInNewWindow = true; 
        RadGrid1.MasterTableView.ExportToExcel(); 
    } 


Thanks
Shinu.
0
Paul
Top achievements
Rank 1
answered on 14 Aug 2008, 12:28 PM
Hi Shinu,

I have this option set (I have included my code below).  I define my grid in the codebehind the not aspx do i need to set any flags on the detail table to indicate it can be exported?


Thanks

Button code:

    protected void ExportToExcel_Click(object sender, ImageClickEventArgs e)
    {
        rgScout.ExportSettings.ExportOnlyData = true;
        rgScout.ExportSettings.IgnorePaging = true;
        rgScout.ExportSettings.OpenInNewWindow = true;
        rgScout.ExportSettings.FileName = "ScoutChanges";
        rgScout.MasterTableView.ExportToExcel();

    }

This is how I define the detail table

  // Add the child table for the history records//////////////////////////////// 
        rgScout.MasterTableView.DetailTables.Add(new GridTableView()); 
        rgScout.MasterTableView.DetailTables[0].DataMember = "Child"; 
        rgScout.MasterTableView.DetailTables[0].Caption = "Changes to the information about a person"; 
 
 
        // Action Audit ID - Child 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = ""; 
        gridCol.DataField = "PersonID"; 
        gridCol.Visible = false; 
 
        // Action - Child 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "Action"; 
        gridCol.DataField = "Action"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "SAP Number"; 
        gridCol.DataField = "SAPEmployeeNumber"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "Forename"; 
        gridCol.DataField = "Forename"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "Surname"; 
        gridCol.DataField = "Surname"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "Gender"; 
        gridCol.DataField = "Sex"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "From Date"; 
        gridCol.DataField = "fromdate"; 
 
        gridCol = new GridBoundColumn(); 
        rgScout.MasterTableView.DetailTables[0].Columns.Add(gridCol); 
        gridCol.HeaderText = "To Date"; 
        gridCol.DataField = "todate"; 
 

Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Paul
Top achievements
Rank 1
Share this question
or