0

こんにちは、Telerik RadGrid を使用した DNN アプリケーションを作成しました。グリッドから一部のデータをエクスポートしていますが、グリッド コントロールをドリルダウンしてデータをエクスポートすると、最初の最上位データのみが表示され、更新されたグリッドは表示されません。これが私のテーブルタグとサポートコードです。私は ASPX/C# の専門家ではないので、初心者であることをお許しください。

<mastertableview autogeneratecolumns="False" datakeynames="AccountId" datasourceid="SqlDataSource1"
    groupsdefaultexpanded="False">

    <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>

エクスポートは、ロード時にスクリプト マネージャーに登録されます。

protected void Page_Load(object sender, EventArgs e)
{
    Button2.Enabled = Session[UserSelection.SelectedValue] != null ? true : false;
    ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button3); 
    ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button4); 
}

そして、私は次のようにエクスポートを呼び出しています:

protected void Button3_Click(object sender, System.EventArgs e)
    {
        //ConfigureExport();
       RadGrid1.Rebind();
       RadGrid1.ExportSettings.FileName = "RadGridExportToExcel";
       RadGrid1.ExportSettings.ExportOnlyData = true;
       RadGrid1.ExportSettings.OpenInNewWindow = true;

        RadGrid1.MasterTableView.ExportToExcel();
    }

DNN / ASPXの経験と生きる意志を除けば、私が欠けているものを誰でも見ることができます:)

4

1 に答える 1

0

解決済み:しかし完全ではない...以下を追加することにより

RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;

button_click イベントに例:

protected void Button3_Click(object sender, System.EventArgs e)
    {
        //ConfigureExport();
       RadGrid1.Rebind();
       RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;
       RadGrid1.ExportSettings.FileName = "RadGridExportToExcel";
       RadGrid1.ExportSettings.IgnorePaging = true;
       RadGrid1.ExportSettings.ExportOnlyData = true;
       RadGrid1.ExportSettings.OpenInNewWindow = true;

        RadGrid1.MasterTableView.ExportToExcel();
    }

これは第 1 レベルのグループ化のみを提供しますが、サブグループは提供しません。また、選択したドリルダウン データをエクスポートするだけでなく、グリッド全体の展開ビューを最初のレベルにエクスポートするだけではありません。最後に、3 次詳細テーブルを機能させるために追加できます。

RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;

これにより、DNN で OOM エラーがスローされました。

A critical error has occurred.
Exception of type 'System.OutOfMemoryException' was thrown.

ある種のイベント処理を行い、手動でモーダル ウィンドウでデータを開き、代わりにそれをエクスポートする必要があると思います。

于 2011-01-06T12:27:45.743 に答える