Edit this page

Filtering

RadGridView provides you with a built-in filtering functionality, which allows the user to easily filter the data by one or more columns, just by clicking on the filtering icon next to the header text.

You can define filtering either in the XAML or in the code-behind.

XAML

<telerik:RadGridView x:Name="radGridView">
    <telerik:RadGridView.FilterDescriptors>
        <telerik:FilterDescriptor Member="Country"
                             Operator="IsEqualTo"
                             Value="Germany"/>
    </telerik:RadGridView.FilterDescriptors>
</telerik:RadGridView>

You can achieve the same result if you define your filtering in your code-behind like this.

C#

FilterDescriptor descriptor = new FilterDescriptor();
descriptor.Member = "Country";
descriptor.Operator = FilterOperator.IsEqualTo;
descriptor.Value = "Germany";
this.radGridView.FilterDescriptors.Add(descriptor);

VB.NET

Dim descriptor As New FilterDescriptor()
descriptor.Member = "Country"
descriptor.Operator = FilterOperator.IsEqualTo
descriptor.Value = "Germany"
Me.radGridView.FilterDescriptors.Add(descriptor)

Note that since FilterDescriptors property is a collection, you can add more than one FilterDescriptor to a RadGridView.

The Operator property allows you to define the type of filter operator you wish to use. The possible values are defined in the FilterOperator enumeration:

  • Contains - dataField LIKE '%value%'

  • EndsWith - dataField LIKE '%value'

  • IsEqualTo - dataField = value

  • IsGreaterThan - dataField > value

  • IsGreaterThanOrEqualTo - dataField >= value

  • IsLessThan - dataField < value

  • IsLessThanOrEqualTo - dataField <= value

  • IsNotEqualTo - dataField != value

  • StartsWith - dataField LIKE 'value%'

  • IsNull - dataField = null

  • IsNotNull - dataField != null

  • IsEmpty - dataField = string.Empty

  • IsNotEmpty - dataField != string.Empty

You could localize those strings. For the complete list of the localization strings please check this how to topic.

The list of filter operations depends on the DataType property of the column. For example, the filter operations "StartsWith", "EndsWith, "IsEmpty, "IsNotEmpty... " will not be available for columns of Integer or DateTime types.

Consider using the code-behind approach only when changing the filtering criteria run-time.

Check out the chapters entirely dedicated to the filtering functionality of RadGridView and find the answers to many questions like:

See Also