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

Total record in the radgrid

3 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark de Torres
Top achievements
Rank 1
Mark de Torres asked on 27 Aug 2010, 03:45 AM

Hi, I would like to display footer with total record. I am successfully display it. However, when i am export to pdf, the correct total show in the footer however, the export does not exporting all record even in the radgrid itself the record has more than one page. Please advise

 

 

 

 

private int parentAccountWithChildTotalCount = 0;

 

 

 protected void ParentAccountGridWithChild_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFooterItem)
        {
            GridFooterItem footer = (GridFooterItem)e.Item;
            Label lblTotalRowCount = new Label();
            lblTotalRowCount.Text = "Total Record: " + this.parentAccountWithChildTotalCount.ToString();
            footer["Firstname"].Controls.Add(lblTotalRowCount);
        }
    }
 

public int ParentAccountWithChildTotalCount
    {
        set { parentAccountWithChildTotalCount = value; }
    }

protected void ParentExportPDFButton_Click(object sender, EventArgs e)
    {
        ParentAccountWithChild.ExportSettings.ExportOnlyData = true;
        ParentAccountWithChild.MasterTableView.ExportToPdf();
       
    } 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Aug 2010, 07:09 AM
Hello Mark,


Set the "ExportSettings -> IgnorePaging" property of grid to True in order to include all the records (regardless of paging) when exporting.

Also you can set the Aggregate property of column to show total "count" in the footer section.
Column Aggregates


-Shinu.
0
Mark de Torres
Top achievements
Rank 1
answered on 29 Aug 2010, 02:54 PM
I have tried with your suggestion but it still having a problem with exporting the whole records.

<telerik:RadGrid ID="ParentAccountGridWithChild" runat="server"  Width="55%" AllowPaging="True" Visible="false"
                                            AllowSorting="True" AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True"
                                            GridLines="None" LoadingTemplateTransparency="25" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
                                             AllowAutomaticDeletes="false"  OnNeedDataSource="ParentAccountGridWithChild_NeedDataSource" GroupingEnabled="true" ShowFooter="true"
                                             Skin="Office2007" >
                                             <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                                            <ClientSettings ReorderColumnsOnClient="true" >
                                                <Resizing AllowRowResize="true" EnableRealTimeResize="true" ResizeGridOnColumnResize="false" AllowColumnResize="true" />
                                            </ClientSettings>
                                            <ExportSettings FileName="Parent Account Created Export" IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="false">
                                                <Pdf PageHeight="210mm" PageWidth="297mm" PageBottomMargin="10mm" PageTopMargin="10mm"
                                                    PageLeftMargin="2mm" PageRightMargin="2mm" />
                                            </ExportSettings>
                                            <MasterTableView TableLayout="Fixed" Width="100%" CommandItemDisplay="None"> 
                                           
                                               
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="Firstname" 
                                                                             HeaderText="Firstname" 
                                                                             SortExpression="Firstname" 
                                                                             UniqueName="Firstname">
                                                    </telerik:GridBoundColumn>
                                                  
                                                    <telerik:GridBoundColumn DataField="ADCommonName"
                                                                             Aggregate="Count" 
                                                                             HeaderText="ADCommonName" 
                                                                             SortExpression="ADCommonName"
                                                                             FooterText=" "
                                                                             AllowFiltering ="false"
                                                                             UniqueName="ADCommonName">
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridTemplateColumn HeaderText="Date Created" HeaderStyle-Width="90px">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDateCreated" 
                                                                               runat="server" 
                                                                               Text='<%# FormatDate(Eval("DateCreated"))%>'> 
                                                                    </asp:Label>
                                                                </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                </Columns>
                                                <ExpandCollapseColumn Resizable="True" Visible="False">
                                                    <HeaderStyle Width="20px" />
                                                </ExpandCollapseColumn>
                                                <RowIndicatorColumn Visible="False">
                                                    <HeaderStyle Width="20px" />
                                                </RowIndicatorColumn>
                                            </MasterTableView>
                                        
                                    </telerik:RadGrid>   
0
Mark de Torres
Top achievements
Rank 1
answered on 31 Aug 2010, 06:34 AM
The problem has fixed. The paging was not handle correctly therefore when the exporting only exporting the first page
Tags
Grid
Asked by
Mark de Torres
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mark de Torres
Top achievements
Rank 1
Share this question
or