# Bound Mode

## Content



The List supports data binding to commonly used data sources such as ObservableCollection, IList \<T>, List\<T>, ADO.NET objects such as DataSet, DataTable, etc. In the bound mode, the list fetches its data from the underlying data source. Additionally, it lets multiple data consumers be connected to a single data provider in a synchronized manner.

For detailed information on how to bind List to a data source, refer to the following links:

*   To bind List to a data source in .NET, see [Binding to a Data Source](/componentone/docs/win/online-list/listforwinformsquick#bound1).
*   To bind List to a data source in .NET Framework through code, see [Binding to a Data Source](/componentone/docs/win/online-list/listforwinformsquick#bound3) and to bind a list at design-time, see [Binding at design time](/componentone/docs/win/online-list/listforwinformsquick#bound2).

## Operations in Bound Mode

List lets you perform operations in bound mode. Let us discuss some common operations that can be performed in bound mode in the List control.

### Add Unbound Column in Bound Mode

Normally, List automatically displays data from bound database fields. However, you may need to augment the set of fields present in your layouts with columns derived from database fields, or columns which are unrelated (or only loosely related) to database information. For example, if your database contains a Balance field, you may instead want to display two columns, Credit and Debit. To accomplish this task, you can use unbound columns to display data that does not exist in the data source.

List provides **Add** and **Insert** methods in the <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="C1DataColumnCollection" data-popup-theme="ui-tooltip-green qtip-green">C1DataColumnCollection</span> class to add an unbound column to the list. While the Add method adds a column at the end, the Insert method lets you specify the position where you want to add a new column.

Use the following code to add an unbound column to the list.

```csharp
C1DataColumn dc = new C1DataColumn();
//sets the caption of unbound column
dc.Caption = "Available Value";
//add new unbound column
c1List1.Columns.Add(dc);
```

Similarly, you can create multiple unbound columns in List by using the Add method.

### Set Values in Unbound Column

To define values in the unbound column of bound list, you need to use **UnboundColumnFetch** event of the <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-list/\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="C1List" data-popup-theme="ui-tooltip-green qtip-green">C1List</span> class. This event automatically gets fired when the control needs to display the value of cells in an unbound mode.

This example uses the sample created in the [Quick Start](/componentone/docs/win/online-list/listforwinformsquick) topic. Here, the product of two column fields "**UnitsInStock**" and "**UnitPrice**" is displayed in the unbound column "**Available Value**" using the UnboundColumnFetch event.

```csharp
private void C1List1_UnboundColumnFetch(object sender, UnboundColumnFetchEventArgs e)
{
    if (c1List1.Columns[e.Col].Caption == "Available Value")
    {
        var units = int.Parse(c1List1.Columns["UnitsInStock"].CellText(e.Row));
        var price = int.Parse(c1List1.Columns["UnitPrice"].CellText(e.Row));
        e.Value = (units * price).ToString();
    }
}
```

Similarly, the **UnboundColumnFetch** event can also be used to populate more than one unbound columns at the same time. For example, in the following code, we populate two unbound columns, "AvailableValue" and "Profit".

```csharp
private void C1List1_UnboundColumnFetch(object sender, UnboundColumnFetchEventArgs e)
{
   //pupulates the unbound column using if-else condition
    if (this.c1List1.Columns[e.Col].Caption == "AvailableValue")
    {
        var units1 = int.Parse(c1List1.Columns["UnitsInStock"].CellText(e.Row));
        var price = int.Parse(c1List1.Columns["UnitPrice"].CellText(e.Row));
        //sets the value
        e.Value = (units1 * price).ToString();
    }
    if (this.c1List1.Columns[e.Col].Caption == "Profit")
    {
        var price = int.Parse(c1List1.Columns["UnitPrice"].CellText(e.Row));
        //sets the value
        e.Value = (((4* price)/100)+price).ToString();
    }
}
```