# Row Filter

## Content



RowFilter lets you narrow down display records according to a specified condition applied on a column field. It is especially useful in case of large number of list items, as it lets you easily analyze data by displaying a specific type of records only. Please note that RowFilter can only be applied if the list is bound to a data source.

![Row Filter in List](https://cdn.mescius.io/document-site-files/images/1e4aa2c8-7f81-4e43-8ed4-f673f1e68381/images/rowfilter.gif)

To enable filtering using row filter, you can use the **RowFilter** property of the **DataView** class. The following code demonstrates how to modify the default view of the data table by using the RowFilter property. In this example, we apply filtering on "CategoryID" column field.

```csharp
//set the row filter by setting default view of data source
dt.DefaultView.RowFilter = "CategoryId = 1";
//bind to list
c1List1.DataSource = dt;
```

## Clear Filter

To return to the default view or undo the filter operation, you need to set the value of **RowFilter** property to an empty string as shown in the following code. In this example the code is added to the Clear button's Click event:

```csharp
//clear the filter
dt.DefaultView.RowFilter = " ";
```