# Data Binding

## Content

MultiColumnCombo supports bound and unbound modes to display data. In bound mode, you can bind the MultiColumnCombo control to a data source to populate data in it, while in unbound mode, you can manually populate the control with data. Let us discuss how to bind data in bound and unbound modes in detail in the following sections.

## Bound Mode

Bound mode, as the name suggests, refers to a state where control fetches its data from an underlying data source. MultiColumnCombo can be bound to commonly used data sources such as ObservableCollection, IBindingListView, IList \<T>, List\<T>, etc.
![MultiColumnCombo control in bound mode](https://cdn.mescius.io/document-site-files/images/186267ac-7e18-4bb3-aa58-4779d3437a3a/images/multicolumncombo-bound-mode.png)
To bind the MultiColumnCombo control to data, you need to set the data source object using [DataSource](/componentone/docs/win/online-multicolumncombo/) property of the [C1MultiColumnCombo](/componentone/docs/win/online-multicolumncombo/) class as showcased in the following code. In addition to the **DataSource** property, you also need to set the [DisplayMember](/componentone/docs/win/online-multicolumncombo/) and [ValueMember](/componentone/docs/win/online-multicolumncombo/) properties of the **C1MultiColumnCombo** class when binding the MultiColumnCombo control to the data in bound mode. The **DisplayMember** property sets the DataSource field to display as text of the control and the **ValueMember** specifies the field name as value for binding purposes. The following example uses [DataSource Class](/componentone/docs/win/online-multicolumncombo/databinding#datasource-class) to get the data.

```csharp
var data = new BindingSource(DataSource.GetSalesInfo(), "");
mcc.DataSource = data;
mcc.DisplayMember = "Product";
mcc.ValueMember = "Id";
```

## Unbound Mode

As the name suggests, in unbound mode, MultiColumnCombo control is not bound to any data source and data is stored in the control itself. In this case, you need to provide data by adding rows and/or columns either at design time or programmatically.

![MultiColumnCombo control in unbound mode](https://cdn.mescius.io/document-site-files/images/186267ac-7e18-4bb3-aa58-4779d3437a3a/images/multicolumncombo-unbound.png)

To provide data to MultiColumnCombo in unbound mode, first you need to add columns to the control using the **Add** method and then add items in the control using the [AddItem](/componentone/docs/win/online-multicolumncombo/) method as shown in the following code. In MultiColumnCombo, the columns in the dropdown view are represented by [DisplayColumn](/componentone/docs/win/online-multicolumncombo/) class. This class provides all the properties that are specific to the columns, for example, [Name](/componentone/docs/win/online-multicolumncombo/) and [Caption](/componentone/docs/win/online-multicolumncombo/) properties. When you add columns in MultiColumnCombo, you need to set the **Name** and **Caption** properties for the column being added. The following example uses [Customer class](/componentone/docs/win/online-multicolumncombo/databinding#customer-class) to get the data for the control.

```csharp
C1.Win.Input.MultiColumnCombo.DisplayColumn displayColumn1 = new C1.Win.Input.MultiColumnCombo.DisplayColumn();
C1.Win.Input.MultiColumnCombo.DisplayColumn displayColumn2 = new C1.Win.Input.MultiColumnCombo.DisplayColumn();
displayColumn1.Caption = "Name";
displayColumn1.Name = "Name";
displayColumn2.Caption = "Capital";
displayColumn2.Name = "Capital";
mcc.Columns.Add(displayColumn1);
mcc.Columns.Add(displayColumn2);
mcc.AddItem(Country.GetCountry(0).ToString());
mcc.AddItem(Country.GetCountry(1).ToString());
mcc.AddItem(Country.GetCountry(2).ToString());
mcc.AddItem(Country.GetCountry(3).ToString());
mcc.AddItem(Country.GetCountry(4).ToString());
```