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

DataFilter not filtering GridView - no event takes place

2 Answers 55 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 26 Feb 2013, 04:23 PM
I have created a DataFilter and GridView, but when I enter info into my filter the grid does not update. It acts as if there is no connection or bond between the filter and the grid itself. For what it is worth, my DataPager does not page through the GridView either. I presume the same erroneous code (or missing code) is similar to both the DataFilter and the DataPager. Here is my code:

MainPage.xaml
<UserControl x:Class="ClientConflictSearch.MainPage"
    xmlns:dataFilter="clr-namespace:Telerik.Windows.Controls.Data.DataFilter;assembly=Telerik.Windows.Controls.Data"
    mc:Ignorable="d"
    d:DesignHeight="600" d:DesignWidth="800" >
 
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel Height="580" Width="780" HorizontalAlignment="Left" Margin="5,5,0,0" Name="stackPanel1" VerticalAlignment="Top" Orientation="Vertical">
            <telerik:RadDataFilter x:Name="radDataFilter" Height="100" ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="1">
            </telerik:RadDataFilter>
            <telerik:RadGridView x:Name="radGridView"
                                ItemsSource="{Binding PagedSource, ElementName=radDataPager}"
                                AutoGenerateColumns="False"
                                IsFilteringAllowed="False" Margin="0,5,0,0" Width="765" Height="440"
                                ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                >
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding cName}" Width="450" Header="Client Name" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding cAtty}" Width="150" Header="Billing Attorney" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding cNum}" Width="150" Header="Client Number" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            <telerik:RadDataPager x:Name="radDataPager"
                            Grid.Row="1"
                            DisplayMode="All"
                            PageSize="20"
                            Margin="0,10,0,0"/>
        </StackPanel>
         
         
    </Grid>
</UserControl>

MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel;
using ClientConflictSearch.ConflictService;
using Telerik.Windows.Data;
 
namespace ClientConflictSearch
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            SearchServiceClient ssc = new SearchServiceClient();
            ssc.SearchListCompleted += new EventHandler<SearchListCompletedEventArgs>(ssc_SearchListCompleted);
            ssc.SearchListAsync();
 
        }
 
        void ssc_SearchListCompleted(object sender, SearchListCompletedEventArgs e)
        {
            radGridView.IsBusy = true;           
            radGridView.ItemsSource = e.Result;
            radDataPager.Source = e.Result;
            radDataFilter.Source = e.Result;
            radGridView.IsBusy = false;
            this.radDataPager.Source = e.Result;
             
        }
    }
}

Class file named "ConflictSearch.cs"

public class ConflictSearch
    {
        public string cName { get; set; }
        public string cAtty { get; set; }
        public string cNum { get; set; }
    }


Why is my filter not filtering the GridView?



2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 27 Feb 2013, 01:55 PM
Hi,

You have not connected the RadDataFilter's Source to the Items collection of the RadGridView. Please check this online demo for a reference on how to configure it properly. 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 27 Feb 2013, 04:21 PM
I don't understand the code in the demo:
Source="{Binding Items, ElementName=radGridView}"
because I do not have an 'Items' object. Is this native to Telerik? Can you please explain in more detail instead of pointing me to your demo? I tried to add this line of code to both the "RadDataFilter" and also the "RadDataPager". When I added it to the "RadDataFilter" nothing changed. When I added it to the "RadDataPager" it blew up with an error citing "infinite loop recursion".
Tags
DataFilter
Asked by
Alex
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Alex
Top achievements
Rank 1
Share this question
or