Problem with pagination and Export

1 posts, 0 answers
  1. jonathan
    jonathan avatar
    1 posts
    Member since:
    Nov 2017

    Posted 07 Nov 2017 Link to this post

    Hi, 

    I got a problem for using RadGrid Pagination and Export, with Hierarchy detailsTables.

    Indeed When I perform an export Excel, I want to get all data in details tables.

    The export is Good with all datas.

    But after the dowload when i click on next , previous or collapse.

    the pagination at the first level is not more activate, and all grids are expanded.

    I would like at least after the download to have all grids collapse.

     

    <div class="tableSimple">            <telerik:RadGrid AllowPaging="true" ID="RadGridCompteFournisseur" OnItemDataBound="RadGridCompteFour_ItemCreated"  runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None"          MasterTableView-GroupLoadMode="Client" OnNeedDataSource="RadGridCompteFour_NeedDataSource" OnDetailTableDataBind="RadGridCompteFour_DetailTableDataBind" HierarchyDefaultExpanded="false"         ClientSettings-AllowExpandCollapse="true" SortingSettings-EnableSkinSortStyles="false" ClientSettings-EnableRowHoverStyle="true" OnItemCommand="RadGridCompteFournisseur_ItemCommand"         OnItemCreated="RadGridCompteFour_ItemCreated" OnPreRender="RadGridCompteFour_PreRender"          OnExcelMLExportRowCreated="RadGridCompteFour_ExcelMLExportRowCreated" OnExcelMLExportStylesCreated="RadGridCompteFour_ExcelMLExportStylesCreated">         <ExportSettings FileName="compte" Excel-Format="Html" ExportOnlyData="true" OpenInNewWindow="true"></ExportSettings>         <MasterTableView DataKeyNames="Nom,ID" Name="Compte" ShowHeader="true" ShowHeadersWhenNoRecords="false" UseAllDataFields="true" AllowSorting="true" AllowMultiColumnSorting="false" AllowNaturalSort="false">             <SortExpressions>                 <telerik:GridSortExpression FieldName="Nom" SortOrder="Ascending" />             </SortExpressions>             <Columns>                 <telerik:GridBoundColumn DataField="Nom" HeaderText="Nom" SortExpression="Nom" UniqueName="Nom" HeaderStyle-CssClass="colImmeNomHeader" ItemStyle-CssClass="colImmeNomItem" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowSorting="False">                 </telerik:GridBoundColumn>                 <telerik:GridBoundColumn DataField="Solde" HeaderStyle-CssClass="colEcheanceDateHeader" ItemStyle-CssClass="colEcheanceDateItem" SortExpression="Solde" UniqueName="Solde" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">                 </telerik:GridBoundColumn>             </Columns>             <DetailTables>                 <telerik:GridTableView   Name="Immeubles"  DataKeyNames="ImmeNo,IDDTOImmeuble" Width="100%" ShowHeader="true" ShowHeadersWhenNoRecords="false" HorizontalAlign="Right" UseAllDataFields="true">                     <SortExpressions>                         <telerik:GridSortExpression FieldName="Ville" SortOrder="Ascending" />                     </SortExpressions>                     <Columns>                         <telerik:GridBoundColumn DataField="Nom" HeaderStyle-CssClass="colImmeNomHeader" ItemStyle-CssClass="colImmeNomItem" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowSorting="False">                         </telerik:GridBoundColumn>                         <telerik:GridBoundColumn DataField="Adresse"  HeaderStyle-CssClass="colImmeAdresseHeader" ItemStyle-CssClass="colImmeAdresseItem" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" AllowSorting="False">                         </telerik:GridBoundColumn>                         <telerik:GridBoundColumn DataField="Ville" HeaderStyle-CssClass="colImmeVilleNomHeader" ItemStyle-CssClass="colImmeVilleNomItem" UniqueName="Ville" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">                         </telerik:GridBoundColumn>                         <telerik:GridBoundColumn DataField="Solde" HeaderStyle-CssClass="colPlanSoldeHeader" ItemStyle-CssClass="colPlanSoldeItem noWrap" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">                         </telerik:GridBoundColumn>                     </Columns>                     <DetailTables>                         <telerik:GridTableView Name="Details"  DataKeyNames="Piece1" Width="100%" ShowHeader="true" ShowHeadersWhenNoRecords="false" HorizontalAlign="Right" UseAllDataFields="true">                             <SortExpressions>                                 <telerik:GridSortExpression FieldName="DateValeur" SortOrder="Descending" />                             </SortExpressions>                             <Columns>                                 <telerik:GridBoundColumn DataField="Piece1" HeaderStyle-CssClass="colPieceHeader" ItemStyle-CssClass="colPieceItem" SortExpression="Piece1" UniqueName="Piece1" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="50px">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="DateValeur" HeaderStyle-CssClass="colValeurDateHeader" ItemStyle-CssClass="colValeurDateItem" SortExpression="DateValeur" UniqueName="DateValeur" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="DateEcheance" HeaderStyle-CssClass="colEcheanceDateHeader" ItemStyle-CssClass="colEcheanceDateItem" SortExpression="DateEcheance" UniqueName="DateEcheance" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="Reference" HeaderStyle-CssClass="colReferenceHeader" ItemStyle-CssClass="colReferenceItem" HeaderText="Reference" SortExpression="Reference" UniqueName="Reference" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="Libelle" HeaderStyle-CssClass="colLibelleHeader" ItemStyle-CssClass="colLibelleItem" SortExpression="Libelle" UniqueName="Libelle" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="Debit" HeaderStyle-CssClass="colDebitHeader" ItemStyle-CssClass="colDebitItem noWrap" HeaderText="Debit" SortExpression="Debit" UniqueName="Debit" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="Credit" HeaderStyle-CssClass="colCreditHeader" ItemStyle-CssClass="colCreditItem noWrap" HeaderText="Credit" SortExpression="Credit" UniqueName="Credit" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="NonLettre" HeaderStyle-CssClass="colNonLettreHeader" ItemStyle-CssClass="colNonLettreItem noWrap" HeaderText="NonLettre" SortExpression="NonLettre" UniqueName="NonLettre" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">                                 </telerik:GridBoundColumn>                                 <telerik:GridBoundColumn DataField="PDF" HeaderStyle-CssClass="colPdfHeader" ItemStyle-CssClass="colPdfItem" HeaderText="PDF" SortExpression="PDF" UniqueName="PDF" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">                                 </telerik:GridBoundColumn>                             </Columns>                         </telerik:GridTableView>                     </DetailTables>                 </telerik:GridTableView>             </DetailTables>         </MasterTableView>     </telerik:RadGrid></div>

     

     

     

    protected void btnExport_Click(object sender, EventArgs e)        {                RadGridCompteFournisseur.ExportSettings.IgnorePaging = true;                RadGridCompteFournisseur.AllowPaging = true;                foreach (GridTableView tbl in RadGridCompteFournisseur.MasterTableView.DetailTables)                {                    tbl.HierarchyDefaultExpanded = true; //disable paging for the detail grids for the export operation                    tbl.AllowPaging = false;                }                RadGridCompteFournisseur.MasterTableView.HierarchyDefaultExpanded = true;            RadGridCompteFournisseur.MasterTableView.DetailTables[0].HierarchyDefaultExpanded = true;            RadGridCompteFournisseur.MasterTableView.DetailTables[0].DetailTables[0].HierarchyDefaultExpanded = true;                                    RadGridCompteFournisseur.ExportSettings.OpenInNewWindow = true;            IsModeExport = true;            RadGridCompteFournisseur.MasterTableView.DetailTables[0].DetailTables[0].GetColumn("PDF").Visible = false;            RadGridCompteFournisseur.MasterTableView.ExportToExcel();            Statistique stat = Contexte.GestStat;            if (stat != null) stat.Tick("ExportComptes");        }

     

     

     

Back to Top