XtraReportBase.GetCurrentColumnValue<T>(String) Method

Gets the current value (strongly typed) of the specified column in the report's DataSource.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.1.dll


public T GetCurrentColumnValue<T>(
    string columnName
Public Function GetCurrentColumnValue(Of T)(
    columnName As String
) As T


Name Type Description
columnName String

The name of the column to obtain the value from.

Type Parameters



Type Description

A <T> object that corresponds to the current value of the specified column in the data source. If the specified column was not found, this method returns null (Nothing in Visual Basic).


Call the GetCurrentColumnValue<T> method in the XRControl.BeforePrint event handler to obtain the current strongly-typed value of the specified data source property (for instance, when you bind a report to the SQL data source).

If you want to cast the returned object automatically, use the XtraReportBase.GetCurrentColumnValue method.

Use the GetCurrentRow method instead if you have a business object and want to get the value of its method or field that implements custom logic (for instance, if you use the object data source, EF data source or XPO data source).


This example demonstrates how to use the GetCurrentColumnValue method to filter the XRPivotGrid data.

The example assumes that your report is bound to the Northwind database's SalesPerson view. The report data is grouped against the Country member. The Group Header band contains the label that displays the current country and the XRPivotGrid control as shown below.

When the report is previewed, the XRPivotGrid displays the entire data set in each group (that is, displays information for all countries regardless of the group settings).

This example shows how use the GetCurrentColumnValue method to obtain the current group value (the current country) and filter the XRPivotGrid by this country.

using DevExpress.Data.Filtering;
// ...
private void xrPivotGrid1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    // Retrieve the "Country" column's current value.
    string country = GetCurrentColumnValue<string>("Country");

    // Filter the Pivot Grid by the retrieved value.
    xrPivotGrid1.Prefilter.Criteria = new BinaryOperator(
      new OperandProperty("Country"),
      new ConstantValue(country),
See Also