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

Filtering and Paging

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
spt
Top achievements
Rank 1
spt asked on 03 Jun 2009, 01:54 PM
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">
<Columns>
.........
<
telerik:GridTemplateColumn UniqueName="DepartName" AllowFiltering="true">
<ItemTemplate><asp:Label runat="server" ID="Label2" Text='<%# Eval("DepartName") %>' /></ItemTemplate>
<FilterTemplate>

 

<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>

 

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

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

</asp:ObjectDataSource>

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 ;

 

RadGrid1.Rebind();

}

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. 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 08 Jun 2009, 11:18 AM
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,
Iana
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.
0
Ted
Top achievements
Rank 1
answered on 15 Dec 2009, 10:02 PM
I am having this same issue?  was there a fix to it?
0
Iana Tsolova
Telerik team
answered on 16 Dec 2009, 04:16 PM
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,
Iana
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.
Tags
Grid
Asked by
spt
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Ted
Top achievements
Rank 1
Share this question
or