# Data Binding

This topic covers the databinding feature in FlexPivotSlicer.

## Content

**FlexPivotSlicer** supports binding with a data source to display sorted, selected and filtered data. A data source can be assigned to the FlexPivotSlicer through the designer as well as code.

## Binding FlexPivotSlicer to Data Source at Design-Time

This section highlights how to bind the **FlexPivotSlicer** control to a data source at design time.

![Databindingg](https://cdn.mescius.io/document-site-files/images/78f24d1c-0e57-452f-87a1-d318e186587a/images/databindingg.png)

Follow these steps to bind a **FlexPivotSlicer** to a data source:

1. Add the **FlexPivotSlicer** control to your application.
2. In the **Choose Data Source** option, assign an instance of the already configured **FlexPivotPanel**, say **c1FlexPivotPanel1**, as the data source.
3. Select the **FieldName** that you want to filter using the **Field name** option. In this example, we selected **CustomerID**.

## Binding FlexPivotSlicer to Data Source through Code

For binding **FlexPivotSlicer** control with a data source programmatically, you need to create an instance of the [C1FlexPivotSlicer](/componentone/api/win/online-flexpivot/dotnet-framework-api/C1.Win.FlexPivot.Slicer.4.8/C1.Win.FlexPivot.C1FlexPivotSlicer.html) class, and then set the [Field](/componentone/api/win/online-flexpivot/dotnet-framework-api/C1.Win.FlexPivot.Slicer.4.8/C1.Win.FlexPivot.C1FlexPivotSlicer.Field.html) property of the FlexPivotSlicer control. Note that the Field must be added to one of the following collections: **RowFields**, **ColumnFields**, **ValueFields**, or **FilterFields**.

The following code shows how you can add and configure the **FlexPivotSlicer** control to filter the **FlexPivotGrid** or FlexPivotChart data by the field ‘Country’.

```vbnet
'Configure the FlexPivotSlicer control
c1FlexPivotSlicer = New C1FlexPivotSlicer();
c1FlexPivotSlicer.Field = flexPivotPage.PivotEngine.Fields("Country");
```

```csharp
//Configure the FlexPivotSlicer control
c1FlexPivotSlicer = new C1FlexPivotSlicer();
c1FlexPivotSlicer.Field = flexPivotPage.PivotEngine.Fields["Country"];
```

You can also add multiple FlexPivotSlicer controls and bind them to the desired fields to filter the FlexPivotGrid or FlexPivotChart data by multiple fields simultaneously.

The following GIF depicts a scenario where multiple FlexPivotSlicer controls can be configured to display the sales of food products in different countries for the last quarter (October, November, and December) within the pivot grid/pivot chart.

![MultipleSlicerFiltering](https://cdn.mescius.io/document-site-files/images/78f24d1c-0e57-452f-87a1-d318e186587a/images/multipleslicer.gif)

## See Also

[Selection](/componentone/docs/win/online-flexpivot/features/flexpivotsliceroverview/selection)