The requested page is not available for the requested platform. You are viewing the content for Default platform.

XtraReportBase.GetCurrentRow() Method

Returns the currently processed data row from the report's DataSource.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

public object GetCurrentRow()
Public Function GetCurrentRow As Object

Returns

Type Description
Object

A data object from the report's XtraReportBase.DataSource.

Remarks

Call the GetCurrentRow method in the XRControl.BeforePrint event handler to obtain the current row from your business object (for instance, if you bind a report to the object data source, EF data source or XPO data source). You can then use the obtained row to get a value of the object's method or field that implements custom logic.

Use the GetCurrentColumnValue method instead to get the current value of a data source's property (for instance, when you bind a report to the SQL data source).

Example

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

The example assumes that you have the MyOrder business object with the OrderDate, CategoryName, Country, SalesPerson and ExtendedPrice members. The report is bound to this object and 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 GetCurrentRow method to obtain the current group value (the current country) and filter the XRPivotGrid by this country.

using DevExpress.Data.Filtering;
// ...
private void xrPivotGrid1_BeforePrint1(object sender, System.Drawing.Printing.PrintEventArgs e) {
    // Retrieve the current row and get the "Country" member's value.
    var rowOrder = (MyApplication.MyOrder)GetCurrentRow();
    string country = rowOrder.Country;

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