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

Row count After filter on Grid

3 Answers 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Le Danh
Top achievements
Rank 1
Le Danh asked on 26 Nov 2010, 09:22 AM
Hi,

I have seen the answer follow path: http://www.telerik.com/community/forums/aspnet-ajax/grid/total-record-count-after-filter.aspx but i can not fix this error. My scario is below:

1. ASPX Page:
             <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="radGridControl">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="radGridControl" LoadingPanelID="RadAjaxLoadingPanel1"/>
                        </UpdatedControls>
                     </telerik:AjaxSetting>
                 </AjaxSettings>
            </telerik:RadAjaxManager>
            
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="50px" Width="75px" Transparency="25" >
                <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
            </telerik:RadAjaxLoadingPanel>
            
                <telerik:RadFilter runat="server" ID="radFilter" OnApplyExpressions="radFilter_SearchGridData" CssClass="hoanguyen-GridStyleRow">
                   <FieldEditors>
                        <telerik:RadFilterTextFieldEditor DisplayName = "Languge Code" FieldName="LangugeCode" TextBoxWidth="120" />
                        <telerik:RadFilterTextFieldEditor DisplayName = "Languge Name" FieldName="LangugeName" TextBoxWidth="120" />
                   </FieldEditors>                                   
                </telerik:RadFilter>              
            </div>           
            </td>
        </tr>
        <tr>
            <td >            
            <telerik:RadGrid  
            Width="99.8%" ID="radGridControl"
            runat="server"
            AutoGenerateColumns="False"
            AllowSorting="true"
            AllowPaging="True"  
            AllowCustomPaging="true"
            AllowMultiRowSelection="True"  
            CellPadding="0" PageSize="10"  
            VirtualItemCount="100000"
            OnNeedDataSource="radGridControl_NeedDataSource"
            AllowFilteringByColumn="true"
            OnPreRender ="radGridControl_PreRender"
            >
            <PagerStyle Mode="NumericPages" CssClass = "hoanguyen-GridStyleRow"  />  
            <MasterTableView IsFilterItemExpanded="false" Font-Bold="False" TableLayout="Fixed">
                <Columns>
                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkItem" runat="server" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" />                      
                    </HeaderTemplate>
                </telerik:GridTemplateColumn>                   
                <telerik:GridBoundColumn DataField="LanguageCode" HeaderText="Language Code" UniqueName="colLanguageCode">
                    <ItemStyle CssClass="hoanguyen-GridStyleRow"  />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LanguageName" HeaderText="Language Name" UniqueName="colLanguageName">
                    <ItemStyle CssClass="hoanguyen-GridStyleRow"  />
                </telerik:GridBoundColumn>
             
                </Columns>
            </MasterTableView>
            <ClientSettings  EnableRowHoverStyle="True">
                <Selecting AllowRowSelect="True" />
                <ClientEvents  OnRowSelected="RowSelected" />
                <Scrolling
                            AllowScroll="True"
                            ScrollHeight="320"  
                            EnableVirtualScrollPaging="True"
                            UseStaticHeaders="True" />
            </ClientSettings>
            <AlternatingItemStyle    Height="20px" />
            <ItemStyle  Height="20px"  />
            <HeaderStyle Height="20px"  CssClass="hoanguyen-GridStyleRow" Font-Bold="True"  />
            </telerik:RadGrid>
2. Code-behid:
    protected void radGridControl_PreRender(object sender, EventArgs e)
    {
        if (check)
        {
            radGridControl.AllowPaging = false;
            radGridControl.Rebind();
           
            int intRecordCount = radGridControl.MasterTableView.Items.Count;
            radGridControl.AllowPaging = true;
            radGridControl.AllowCustomPaging = true;
            radGridControl.Rebind();
        }
    }

    protected void radFilter_SearchGridData(object sender, RadFilterApplyExpressionsEventArgs e)
    {
        RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
        provider.ProcessGroup(e.ExpressionRoot);
        radGridControl.MasterTableView.FilterExpression = provider.Result;
        radGridControl.Rebind();

        check = true;
    }
Note: "int intRecordCount = radGridControl.MasterTableView.Items.Count;" line is still error because the result is row count for earch page. It is not total rows on grid after click event "OnApplyExpressions="radFilter_SearchGridData" of Filter.

Please, do you help me this problem?

Thansks,

Mr PhuongLD


3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Nov 2010, 05:32 PM
Hello,

More information about how to show grand total in a column footer which calculates the sum for the data in the column cells in all available pages you can find in Displaying totals for all grid pages section in this help article.

I hope this gets you started properly.

Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Le Danh
Top achievements
Rank 1
answered on 28 Nov 2010, 06:33 PM
OK, Thank Pavlina. I already have fixed this error.



Thank you for your reply.

PhuongLD
0
Pavlina
Telerik team
answered on 29 Nov 2010, 08:25 AM
Hi,

I am glad you managed to fix the error. In case you experience any further problems, do not hesitate to contact us again.

Best wishes,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart 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
Le Danh
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Le Danh
Top achievements
Rank 1
Share this question
or