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

filterdescriptor

1 Answer 122 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sum sum
Top achievements
Rank 1
sum sum asked on 04 Nov 2009, 09:53 PM
Hi Guys,

I want to add a filter to select any rows that has id from an array, let's say [1, 5, 18]. 

How to write the property filterdescriptor?

this
.CustomersGridView.FilterDescriptors.Add(new FilterDescriptor("Id", FilterOperator???

 

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 05 Nov 2009, 02:29 PM
Hello sum sum,

Here is how to do it:

using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
 
namespace TicketID_255841_CompositeFilterDescriptor
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
 
            int[] playerNumbers = new [] {25, 23, 8, 9};
             
            CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
            compositeFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
             
            foreach (int playerNumber in playerNumbers)
            {
                FilterDescriptor numberFilter = new FilterDescriptor("Number", FilterOperator.IsEqualTo, playerNumber);
                compositeFilter.FilterDescriptors.Add(numberFilter);
            }
             
            this.playersGrid.FilterDescriptors.Add(compositeFilter);
             
            this.playersGrid.ItemsSource = Club.GetPlayers();
        }
    }
}

I have attached a sample project. I hope it helps.

Kind regards,
Ross
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
GridView
Asked by
sum sum
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or