RadGrid filter and paging

4 posts, 0 answers
  1. Matteo Beretta
    Matteo Beretta avatar
    21 posts
    Member since:
    Apr 2010

    Posted 18 May 2010 Link to this post

    Hi, i have a management problem,

    i have a grid that have a query as datasource, grid is enabled to filter and paging, when i filter, it filter for all pages, 

    so the result is:

    Page1 - result

    Page2 - result etc etc

    i want the it filtering for all the pages and then refresh the number of pages;

    Now post some code because mi english is bad:

    thank you.

    <telerik:RadScriptManager runat="server" ID="Scipr"></telerik:RadScriptManager>  
     
    <telerik:RadGrid runat="server" ID="rgrProva" Skin="Hay"   
            AutoGenerateColumns="false" AllowFilteringByColumn="true"  
            onpageindexchanged="rgrProva_PageIndexChanged" EnableLinqExpressions="false"  
            onneeddatasource="rgrProva_NeedDataSource" >  
     
        <PagerStyle Mode="NumericPages" />  
        <ClientSettings>  
        <Selecting  AllowRowSelect="true"/>  
        </ClientSettings>  
            <MasterTableView>  
                <Columns>  
                <telerik:GridNumericColumn UniqueName="colAnno" DataField="RIC.reqann">  
                </telerik:GridNumericColumn>  
                <telerik:GridNumericColumn UniqueName="colNumero" DataField="RIC.reqnum" FilterControlWidth="40px"   
                AutoPostBackOnFilter="false" CurrentFilterFunction="Contains" FilterDelay="4000" ShowFilterIcon="false">  
                </telerik:GridNumericColumn>  
                <telerik:GridBoundColumn UniqueName="colCliente" DataField="RIC.reqcli">  
                </telerik:GridBoundColumn>  
                </Columns>  
            </MasterTableView>  
    </telerik:RadGrid> 

       protected void Page_Load(object sender, EventArgs e)  
            {  
                      
            }  
     
            private void _Load(int PageNumber)  
            {  
                rgrProva.AllowPaging = true;  
                rgrProva.PageSize = 15;  
                rgrProva.PagerStyle.Mode = GridPagerMode.NumericPages;  
                rgrProva.AllowCustomPaging = true;  
     
                FinitenessEntities context = new FinitenessEntities();  
     
                var qReq = from n in context.RICHIESTE  
                           orderby n.reqann, n.reqnum  
                           select new {RIC = n };  
     
                rgrProva.VirtualItemCount = qReq.Count();  
                rgrProva.DataSource = qReq.Skip(rgrProva.PageSize * PageNumber).Take(rgrProva.PageSize);  
            }  
     
            protected void rgrProva_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)  
            {  
                this._Load(e.NewPageIndex);  
            }  
     
            protected void rgrProva_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
            {  
                this._Load(0);  
            } 

  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 19 May 2010 Link to this post

    Hello Matteo,

    RadGrid supports out-of-the-box the scenario of filtering and paging you have described. However, if you do need to use custom paging, the following online example shoud guide you in that:
    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/custompaging/defaultcs.aspx

    Hope it helps.

    Greetings,
    Tsvetoslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Carlos
    Carlos avatar
    96 posts
    Member since:
    Apr 2013

    Posted 12 Jan 2017 Link to this post

    Hi all,

     

    does anybody has the solution for, Matteo Beretta, problem i have the same problem, i think every body does.

    - have paging working fine, and i have the filters of the radgrid.

    - When i filter the rad grid, the paging mantains the number of pages it had before the filter.

    e.g. if i have 100 pages of data, and filter, it will continue to show 100 pages even knowing that the filter only has twoo rows.

    This is not custom paging problem, its something else

     

  4. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 16 Jan 2017 Link to this post

    Hi Carlos,

    You can take a look at the implementation in the following online demo:
    As you will notice in the code-behind, the custom paging is disabled when there are filter or sort expressions applied and this is due to the fact that the filtering and the sorting will be performed over the DataSource of the grid. 


    Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top