New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms DataFilter

RadDataFilter is a control that allows you to filter your data. It allows you to create complex filter criteria by using unlimited number of filter conditions combined by logical operators. This article will show you how to start using this control.

1. Add a RadGridView, a RadDataFilter and the TelerikMetro theme to a form. Set the theme of all controls to TelerikMetro.

2. Populate the grid using the Nwind database, use the Orders table as a data source. More information is available here. This way the binding source will be automatically created.

At this point your form should look like this:

WinForms RadDataFilter Getting Started

3. Open the Smart Tag of the RadDataFilter control and select the "ordersBindingSource".

WinForms RadDataFilter Smart Tag

4. When the user adds his filtering criteria, the control automatically produces a filter expression available in its Expression property. To apply this filter to the underlying BindingSource, the ApplyFilter method should be invoked. We can use the control events to call the method when new filter is added by the user for example when an item is applied and when removed. Since the RadDataFilter control is build on top of RadTreeView we can use the NodeRemoved and the Edited events for the purpose.

private void RadDataFilter1_NodeRemoved(object sender, RadTreeViewEventArgs e)
{
    radDataFilter1.ApplyFilter();
}
private void RadDataFilter1_Edited(object sender, TreeNodeEditedEventArgs e)
{
    radDataFilter1.ApplyFilter();
}

Private Sub RadDataFilter1_NodeRemoved(ByVal sender As Object, ByVal e As RadTreeViewEventArgs)
    RadDataFilter1.ApplyFilter()
End Sub
Private Sub RadDataFilter1_Edited(ByVal sender As Object, ByVal e As TreeNodeEditedEventArgs)
    RadDataFilter1.ApplyFilter()
End Sub

5. Start the application and add some filters.

WinForms RadDataFilter Getting Started

See Also

Telerik UI for WinForms Learning Resources

In this article