Filtering and Paging

4 posts, 0 answers
  1. spt
    spt avatar
    36 posts
    Member since:
    Sep 2007

    Posted 03 Jun 2009 Link to this post

    I have a grid with the following filter:
     <telerik:RadGrid runat="server" ID="RadGrid1" ShowStatusBar="true" AllowSorting="True" AllowPaging="True" AllowFilteringByColumn="True"  DataSourceID="odsUsers">
    MasterTableView AutoGenerateColumns="false" DataKeyNames="Id" DataSourceID="odsUsers" UseAllDataFields="true">
    telerik:GridTemplateColumn UniqueName="DepartName" AllowFiltering="true">
    <ItemTemplate><asp:Label runat="server" ID="Label2" Text='<%# Eval("DepartName") %>' /></ItemTemplate>


    <telerik:RadComboBox ID="cmbDepartments" DataSourceID="odsDepartments" DataTextField="Name"  DataValueField="Id" AppendDataBoundItems="true" SelectedValue='<%# filterSelectedDepartment %>'  runat="server" OnSelectedIndexChanged="cmbDepartments_SelectedIndexChanged" AutoPostBack="true">


    <Items><telerik:RadComboBoxItem Text="All" Value="0" /></Items>


    </MasterTableView></telerik:RadGrid><asp:ObjectDataSource ID="odsUsers" runat="server" SelectMethod="GetUsersDataSet" TypeName="TA2009.BusinessLogic.UsersManager" OnSelecting="odsUsers_Selecting">

    asp:ObjectDataSource ID="odsDepartments" runat="server"  SelectMethod="GetDepartmentsDataSet" TypeName="TA2009.BusinessLogic.DepartmentsManager" >


    GetUsersDataSet methods returns a whole list of users. I want to filter them by Department.


    protected void cmbDepartments_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)



    RadComboBox cmbDepartments = o as RadComboBox;

    filterSelectedDepartment = cmbDepartments.SelectedValue;
    String filter = String.Empty;

    if (filterSelectedDepartment != "0")
    filter = "DepartId=" + filterSelectedDepartment;
    RadGrid1.MasterTableView.FilterExpression = filter ;




    When filter is applied, only filtered rows remains in the grid, this is right.  But number of pages and records in the paging panel remains the same as it was.
    For example,  let's assume that grid contains 7 records, 5 records are displaing on the page, i.e. there are 2 pages, 5 records on the first page and 2 on the second. Let's assume that only 2 records satisfy to filter criteria, 1 on the first page and 1 on the second.  In this case when filter is appplied, I will still get a grid with 2 pages,  1 record will  be displayed on the first page and one on the second.
    I thought , that I should get a grid with 1 page and 2 records displaying on it.
    Please advice. 









  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 08 Jun 2009 Link to this post

    Hi spt,

    Could you please try sending a stripped runnable version of your code so I could test the case locally and try find the source of the issue?

    Looking forward your reply,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Ted
    Ted avatar
    47 posts
    Member since:
    Jan 2008

    Posted 15 Dec 2009 Link to this post

    I am having this same issue?  was there a fix to it?
  4. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 16 Dec 2009 Link to this post

    Hello Ted,

    Unfortunately I was not able to replicate the issue on my side. So it would be great if you can send a sample page where I could observe the problem and try providing a proper resolution for you. 

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top