Hi, i got this problem. In my grid I can filter on some columns. This is working fine, however when I filter footer of the grid keeps showing the paging despite the fact that the filtering results in less items than configured in the RadGrid (15 items).
For binding the data to the grid I use the Needdatasource-event. In this event I also have some filtering based on previous set session-value.
So filtering does working. But it should not show the paging when I have less than 15 items. Also when paging is shown, it looks like it is still based on the whole dataset. Not the filterd dataset.
When I don't use filtering, paging is working fine.
The filtering set in the needdatasource event is independent from the filtering in the radgrid -filteritems itself.
What am I missing.
Page (aspx)
For binding the data to the grid I use the Needdatasource-event. In this event I also have some filtering based on previous set session-value.
So filtering does working. But it should not show the paging when I have less than 15 items. Also when paging is shown, it looks like it is still based on the whole dataset. Not the filterd dataset.
When I don't use filtering, paging is working fine.
The filtering set in the needdatasource event is independent from the filtering in the radgrid -filteritems itself.
What am I missing.
Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource Dim dtTaxatie As DataTable = (New RisicoTaxatieManager()).GetTaxatieOverzicht() Dim filterExpression As String = String.Empty Dim columnIdent As String = String.Empty Dim row As RisicoTaxatie.libPatientRow = Nothing If (Not Page.IsPostBack) Then If Not Session("PatientRow") Is Nothing Then row = DirectCast(Session("PatientRow"), RisicoTaxatie.libPatientRow) If Not String.IsNullOrEmpty(AppConfig.FilterColumn) Then Select Case AppConfig.FilterColumn Case "MITS" filterExpression = IIf(Not row.IsMitsnummerNull(), "(Mitsnummer='" + row.Mitsnummer.ToString().Trim() + "')", String.Empty) Case "BSN" filterExpression = IIf(Not row.IsBSNnummerNull(), "(BSNnummer='" + row.BSNnummer.ToString().Trim() + "')", String.Empty) Case "VIP" filterExpression = IIf(Not row.IsVIPnummerNull(), "(VIPnummer='" + row.VIPnummer.ToString().Trim() + "')", String.Empty) End Select End If End If End If If AppConfig.FilterPatienten And String.IsNullOrEmpty(filterExpression) Then Dim dtPatienten As DataView = (New RisicoTaxatieManager()).GetMedewerkerPatienten(MedewerkerId) dtPatienten.RowFilter = "Gekoppeld=1" Dim filterPatientId As String = String.Empty For Each PatientRow As DataRowView In dtPatienten filterPatientId += PatientRow("Id").ToString() + "," Next If Not String.IsNullOrEmpty(filterPatientId) Then filterExpression = String.Format("PatientId IN ({0})", filterPatientId.Remove(filterPatientId.Length - 1, 1)) Else filterExpression = "PatientId IS NULL" End If RadGrid1.DataSource = dtTaxatie.Select(filterExpression) Else If String.IsNullOrEmpty(filterExpression) Then RadGrid1.DataSource = dtTaxatie.DefaultView Else RadGrid1.DataSource = dtTaxatie.Select(filterExpression) End If End If If Not String.IsNullOrEmpty(filterExpression) And Not row Is Nothing Then If Not String.IsNullOrEmpty(AppConfig.FilterColumn) Then Select Case AppConfig.FilterColumn Case "MITS" columnIdent = "Mits" Case "BSN" columnIdent = "BSN" Case "VIP" columnIdent = "VIP" End Select Else columnIdent = "Mits" End If Dim column As GridColumn = RadGrid1.MasterTableView.GetColumnSafe(columnIdent) If Not column Is Nothing Then column.CurrentFilterFunction = GridKnownFunction.EqualTo Select Case AppConfig.FilterColumn Case "MITS" column.CurrentFilterValue = row.Mitsnummer.ToString() Case "BSN" column.CurrentFilterValue = row.BSNnummer.ToString() Case "VIP" column.CurrentFilterValue = row.VIPnummer.ToString() End Select End If End If End SubPage (aspx)
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="TaxatieOverzicht.aspx.vb" Inherits="EFPRisicoTaxatie.TaxatieOverzicht" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Overzicht taxaties</title> <meta http-equiv="x-ua-compatible" content="IE=8" /> <link rel="stylesheet" href="Css/RisicoTaxatie.css" type="text/css" /> <script language="javascript" type="text/javascript"> // <!CDATA[ function RowSelected(sender, args) { try { var oWnd = GetRadWindow(); if (oWnd && (args.getDataKeyValue("ID") != '')) { oWnd.close(args.getDataKeyValue("ID")) } } catch (err) { } } // ]]> </script></head><body style="background-color: #f0f0f0;"> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Path="~/js/RisicoTaxatie.js"></asp:ScriptReference> </Scripts> </telerik:RadScriptManager> <div style="background-color: #f0f0f0; padding: 0px; margin: 0px;"> <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" GridLines="None" Style="z-index: 100; left: 0px; position: absolute; top: 0px;" PageSize="15" Width="850px" Height="454px" EnableLinqExpressions="False"> <GroupingSettings CaseSensitive="false" /> <MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID"> <Columns> <telerik:GridBoundColumn DataField="Mitsnummer" HeaderText="Nummer" UniqueName="Mits" AutoPostBackOnFilter="true" Visible="false"> <ItemStyle Width="75px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="BSNNummer" HeaderText="Nummer" UniqueName="BSN" AutoPostBackOnFilter="true" Visible="false"> <ItemStyle Width="75px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="VIPNummer" HeaderText="Nummer" UniqueName="VIP" AutoPostBackOnFilter="true" Visible="false"> <ItemStyle Width="75px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Referentie" HeaderText="Naam" UniqueName="Referentie" AutoPostBackOnFilter="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TaxatieIdent" HeaderText="Taxatie" UniqueName="Taxatie" AutoPostBackOnFilter="true"> <ItemStyle Width="90px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Datum" HeaderText="Tax.datum" DataFormatString="{0:dd-MM-yyyy}" AllowFiltering="False" UniqueName="TaxatieDatum"> <ItemStyle Width="85px" /> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TypeIdent" HeaderText="Type" AllowFiltering="True" UniqueName="Type"> <ItemStyle Width="60px" /> </telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Kader" AllowFiltering="False" UniqueName="Kader"> <ItemTemplate> <asp:Label ID="lblKader" runat="server"></asp:Label> </ItemTemplate> <ItemStyle Width="120px" /> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="situatie" AllowFiltering="False" UniqueName="Situatie"> <ItemTemplate> <asp:Label ID="lblsituatie" runat="server"></asp:Label> </ItemTemplate> <ItemStyle Width="120px" /> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <PagerStyle Wrap="False" Mode="NumericPages" PagerTextFormat="{4} Pagina {0} van {1}, rij {2} tot {3} van {5}" /> <ClientSettings EnablePostBackOnRowClick="False"> <Selecting AllowRowSelect="True" /> <ClientEvents OnRowDblClick="RowSelected" /> </ClientSettings> </telerik:RadGrid> </div> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> </form></body></html>