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

Events

There are two events that are raised when the data in the RadGridView is filtered. The first one is the FilterChanging event and it is raised before the data is filtered. The second one is the FilterChanged event which is raised after the data is filtered.

void radGridView1_FilterChanged(object sender, Telerik.WinControls.UI.GridViewCollectionChangedEventArgs e)
{

}

void radGridView1_FilterChanging(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
{

}


Private Sub RadGridView1_FilterChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangedEventArgs) Handles RadGridView1.FilterChanged

End Sub

Private Sub RadGridView1_FilterChanging(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles RadGridView1.FilterChanging

End Sub

From the event arguments of both events you can access the following data:

  • Action: an enumeration with values: Add, Remove, ItemChanged and Reset. The Action property notifies if a FilterDescriptor is added, removed, modified or the FilterDescriptors collection is cleared.

  • NewItems: List of added, edited or removed FilterDescriptors. For each FilterDescriptor you can get its PropertyName, Operator, Value and Expression.

You are also able to cancel the filtering operation by setting the Cancel property to True.

void radGridView1_FilterChanging1(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
{
    e.Cancel = true;
}

Private Sub RadGridView1_FilterChanging1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles RadGridView1.FilterChanging
    e.Cancel = True
End Sub

Since the FilterDescriptors collection implements the INotifyCollectionChanged interface, you can use its CollectionChanged event:

this.radGridView1.FilterDescriptors.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(FilterDescriptors_CollectionChanged);

AddHandler Me.RadGridView1.FilterDescriptors.CollectionChanged, AddressOf FilterDescriptors_CollectionChanged

void FilterDescriptors_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{

}

Private Sub FilterDescriptors_CollectionChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.Data.NotifyCollectionChangedEventArgs)
    Throw New NotImplementedException
End Sub

The arguments of this event provide the same data as the FilterChanged event.

See Also

In this article