Back to Devexpress

DataSourceColumnBinding Class

aspnet-devexpress-dot-web-dot-aspxpivotgrid-80aea96a.md

latest4.7 KB
Original Source

DataSourceColumnBinding Class

Defines a data binding to a source data column.

Namespace : DevExpress.Web.ASPxPivotGrid

Assembly : DevExpress.Web.ASPxPivotGrid.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class DataSourceColumnBinding :
    DataSourceColumnBindingBase,
    IDataSourceViewSchemaAccessor
vb
Public Class DataSourceColumnBinding
    Inherits DataSourceColumnBindingBase
    Implements IDataSourceViewSchemaAccessor

Remarks

Data binding to columns in the underlying data source is the traditional way to obtain data and display it in the Pivot Grid control.

You can use DataSourceColumnBinding in Optimized, Server, and OLAP data processing modes.

Examples

Optimized and Server Modes

Follow the steps below to bind a Pivot Grid field to a data source column in code:

  1. Create a DataSourceColumnBinding instance.
  2. Set the DataSourceColumnBindingBase.ColumnName property to the name of a data source column.
  3. Assign the DataSourceColumnBinding object to the PivotGridFieldBase.DataBinding property.

The code snippet below illustrates the Pivot Grid’s Extended Price field that is bound to the Extended_Price source column.

Run Demo: Calculated Fields

aspx
<dx:PivotGridField ID="fieldExtended_Price" Area="FilterArea" AreaIndex="0" Caption="Extended Price" >
    <DataBindingSerializable>
        <dx:DataSourceColumnBinding ColumnName="Extended_Price" />
    </DataBindingSerializable>
</dx:PivotGridField>

OLAP Mode

Follow the steps below to bind a Pivot Grid field to a measure or dimension in code:

  1. Create a DataSourceColumnBinding instance.

  2. Specify the DataSourceColumnBindingBase.ColumnName property. ColumnName must specify the full name of the bound measure or dimension.

  3. Assign the DataSourceColumnBinding object to the PivotGridFieldBase.DataBinding property.

The code snippet below illustrates the Product and Quantity Pivot Grid fields that are bound to the Products dimension and Quantity measure.

Run Demo: OLAP Browser

aspx
<dx:PivotGridField Area="RowArea" AreaIndex="1" Caption="Products" ID="field3" SortMode="None" >
    <DataBindingSerializable>
        <dx:DataSourceColumnBinding ColumnName="[Products].[Products].[Products]" />
    </DataBindingSerializable>
</dx:PivotGridField>
<dx:PivotGridField Area="DataArea" AreaIndex="0" Caption="Quantity" ID="field4" CellFormat-FormatString="#.##"
    CellFormat-FormatType="Custom" >
    <DataBindingSerializable>
        <dx:DataSourceColumnBinding ColumnName="[Measures].[Quantity]" />
    </DataBindingSerializable>
</dx:PivotGridField>

See the following topic for more information: Data Binding API.

Implements

INotifyPropertyChanged

DevExpress.XtraPivotGrid.IDesignerContextProvider

IDataSourceViewSchemaAccessor

Inheritance

Object DataBindingBase DataSourceColumnBindingBase DataSourceColumnBinding

See Also

DataSourceColumnBinding Members

Bind Pivot Grid Fields to Data Columns

DevExpress.Web.ASPxPivotGrid Namespace