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

RadGrid Hiearchical export

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 06 Jan 2011, 04:26 PM
Hi I have a RadGrid control showing three levels of detail  ie a RadGrid with two detail tables

Level One --> account, name
Level Two ----> service, details
Level Three ------> service item, usage, date...

I need to allow download of just the selected detail level from the RadGrid.

I can Export either the entire Level One Grid or all the expanded grid fields but not the selected data. Exporting the etire grid gives me an Out of Memory Error with 4Gb RAM

Here's my ASPX
<mastertableview autogeneratecolumns="False" datakeynames="AccountId" datasourceid="SqlDataSource1"
        groupsdefaultexpanded="False"><telerik:CommandItemSettings ShowExportToExcelButton="true" />
         
        <DetailTables>
            <telerik:GridTableView runat="server" DataKeyNames="StatementId" DataSourceID="SqlDataSource2"
                Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                Font-Underline="False" >
                <DetailTables>
                    <telerik:GridTableView runat="server" DataSourceID="SqlDataSource3" Font-Bold="False"
                        Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                        GroupsDefaultExpanded="False" ShowFooter="True" ShowGroupFooter="True" AllowMultiColumnSorting="True"
                        GridLines="None">
                         
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="StatementId" MasterKeyField="StatementId" />
                        </ParentTableRelation>
                        
                        <AlternatingItemStyle BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False"
                            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
                        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" Wrap="True" />
                        <FooterStyle BackColor="Yellow" Font-Bold="False" Font-Italic="False" Font-Overline="False"
                            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
                    </telerik:GridTableView>
                </DetailTables>
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="AccountId" MasterKeyField="AccountId" />
                </ParentTableRelation>
                <CommandItemSettings ExportToPdfText="Export to Pdf" />
                <ExpandCollapseColumn Visible="True">
                </ExpandCollapseColumn>
            </telerik:GridTableView>
        </DetailTables>
        <ParentTableRelation>
            <telerik:GridRelationFields DetailKeyField="AccountId" MasterKeyField="AccountId" />
        </ParentTableRelation>
         
        <ExpandCollapseColumn Visible="True">
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="ACCOUNTID" DataType="System.Int32" HeaderText="ACCOUNTID"
                SortExpression="ACCOUNTID" UniqueName="ACCOUNTID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ACCOUNTREF" HeaderText="ACCOUNTREF" SortExpression="ACCOUNTREF"
                UniqueName="ACCOUNTREF">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CUSTOMERID" DataType="System.Int32" HeaderText="CUSTOMERID"
                SortExpression="CUSTOMERID" UniqueName="CUSTOMERID">
            </telerik:GridBoundColumn>
        </Columns>
    </mastertableview>

Here's the export code on the button.

protected void Button4_Click(object sender, System.EventArgs e)
        {
            //ConfigureExport();
            RadGrid1.Rebind();
            RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
            //RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;
            RadGrid1.ExportSettings.IgnorePaging = true;
            RadGrid1.ExportSettings.ExportOnlyData = true;
            RadGrid1.ExportSettings.FileName = "RadGridExportToCSV";
            RadGrid1.ExportSettings.OpenInNewWindow = true;
 
            RadGrid1.MasterTableView.ExportToCSV();
        }


I've seen a post of someone who had a similar issue but I've not seen a solution anywhere. I'm assuming I might have to use some sort of event capture and loop accordingly?

Thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Jan 2011, 10:39 PM
Hello Chris,

I'm afraid that exporting separate tableviews is not supported out-of-the-box. It is possible however, to hide the unwanted items manually and thus to export a single tableview level. Please examine the attached project for more information.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or