# BindingContext

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Manages the collection of [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) objects for any object that inherits from the [Control](/api/wisej.web/general/control.md) class.

{% tabs %}
{% tab title="C#" %}

```csharp
public class BindingContext : BindingContext
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class BindingContext
    Inherits BindingContext
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) BindingContext()

Creates a new instance of [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md).

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) IsReadOnly

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns whether the collection is read-only.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(dataSource)

[BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md): Returns the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) that is associated with the data source.

### ![](/files/hsR4ok3152WyAf8J2C1u) Item(dataSource, dataMember)

[BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md): Returns a [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) that is associated with the data source and data member.

**Throws:**

* [Exception](https://docs.microsoft.com/dotnet/api/system.exception) The specified *dataMember* does not exist in the specified data source.

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) Add(dataSource, listManager)

Adds the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with a specific data source to the collection.

| Parameter       | Type                                                                              | Description                                                                                                       |
| --------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **dataSource**  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                     | The object associated with the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md). |
| **listManager** | [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) | The [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) to add.                     |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) *dataSource* is null, or *listManager* is null.

### ![](/files/lzopMboA31bVq8UIcbT3) AddCore(dataSource, listManager)

Adds the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with a specific data source to the collection.

| Parameter       | Type                                                                              | Description                                                                                                       |
| --------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **dataSource**  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                     | The object associated with the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md). |
| **listManager** | [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) | The [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) to add.                     |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) *dataSource* is null, or *listManager* is null.

### ![](/files/hsR4ok3152WyAf8J2C1u) Clear()

Clears the collection of any [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) objects.

### ![](/files/lzopMboA31bVq8UIcbT3) ClearCore()

Clears the collection of any [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) objects.

### ![](/files/hsR4ok3152WyAf8J2C1u) Contains(dataSource)

Returns whether the [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) contains the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with the data source.

| Parameter      | Type                                                          | Description                                                                                       |
| -------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An [Object](https://docs.microsoft.com/dotnet/api/system.object) that represents the data source. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) contains the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md); otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) Contains(dataSource, dataMember)

Returns whether the [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) contains the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with the data source and data member.

| Parameter      | Type                                                          | Description                                                                                                                        |
| -------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An [Object](https://docs.microsoft.com/dotnet/api/system.object) that represents the data source.                                  |
| **dataMember** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The information needed to resolve to a specific [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md). |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) contains the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md); otherwise, false.

### ![](/files/hsR4ok3152WyAf8J2C1u) Remove(dataSource)

Removes the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with the specified *dataSource* .

| Parameter      | Type                                                          | Description                                |
| -------------- | ------------------------------------------------------------- | ------------------------------------------ |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object that represents the data source. |

### ![](/files/lzopMboA31bVq8UIcbT3) RemoveCore(dataSource)

Removes the [BindingManagerBase](/api/wisej.web/data-binding/wisej.web.bindingmanagerbase.md) associated with the specified *dataSource* .

| Parameter      | Type                                                          | Description                                |
| -------------- | ------------------------------------------------------------- | ------------------------------------------ |
| **dataSource** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | An object that represents the data source. |

### ![](/files/lIX317sDtMTZJBi9oSIx) UpdateBinding(newBindingContext, binding)

Associates a [Binding](/api/wisej.web/data-binding/wisej.web.binding.md) with a new [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md).

| Parameter             | Type                                                                      | Description                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **newBindingContext** | [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) | The new [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md) to associate with the [Binding](/api/wisej.web/data-binding/wisej.web.binding.md). |
| **binding**           | [Binding](/api/wisej.web/data-binding/wisej.web.binding.md)               | The [Binding](/api/wisej.web/data-binding/wisej.web.binding.md) to associate with the new [BindingContext](/api/wisej.web/data-binding/wisej.web.bindingcontext.md). |

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) CollectionChanged

[CollectionChangeEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.collectionchangeeventhandler) Fired when the collection of data sources changes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.bindingcontext.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
