Handle Column Filter Server Side Events

Handling Server‑Side Events When Applying Column Filters

There are two main events as detailed below.

  1. OnBeforeColumnFilter: Fires before the filter is applied to a column.
  2. OnAfterColumnFilter: Fires after the filter has been applied to a column.

Here is the ASPX script of the Aspose.Cells.GridWeb component to add and assign the aforementioned events.

These events can be used to obtain useful information about the filtering process, such as the column index and the value on which the filter has to be applied. The following snippet demonstrates the usage of the OnBeforeColumnFilter event to retrieve the column index and value that the user has selected on the GridWeb UI for filtering.

On the other hand, if the requirement is to get the number of filtered rows after the filter has been applied, you can use the OnAfterColumnFilter event as demonstrated below.