Back to Devexpress

GetValueEventArgs.Row Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-getvalueeventargs-64aa4b87.md

latest3.3 KB
Original Source

GetValueEventArgs.Row Property

Provides access to a data row whose data can be used to calculate a calculated field‘s custom value in the CalculatedField.GetValue event handler.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public object Row { get; }
vb
Public ReadOnly Property Row As Object

Property Value

TypeDescription
Object

A Object representing a data row.

|

Remarks

Use the Row property to get access to a data row whose data may be necessary when calculating a custom value for a calculated field.

Example

The code sample below performs the following tasks:

  1. Handle a calculated field‘s GetValue event to set the calculated field’s value.
  2. Bind a XRLabel control instance named HeaderLabel to the calculated field described above.
csharp
using System;
using DevExpress.XtraReports.UI;
using DevExpress.DataAccess.Sql.DataApi;
// ...
calculatedField.GetValue += calculatedField_GetValue;
mainReport.Bands["GroupHeaderBand"].Controls["HeaderLabel"].ExpressionBindings.Add(
    new ExpressionBinding() { PropertyName = "Text", Expression = "[calculatedField]" }
    );
// ...
private void calculatedField_GetValue(object sender, GetValueEventArgs e) {
    IRow row = e.Row as IRow;
    object columnValue = row["OrderDate"];
    e.Value = (int)((DateTime)columnValue).DayOfWeek;
}
vb
Imports System
Imports DevExpress.XtraReports.UI
Imports DevExpress.DataAccess.Sql.DataApi
' ...
Private calculatedField.GetValue += AddressOf calculatedField_GetValue
mainReport.Bands("GroupHeaderBand").Controls("HeaderLabel").ExpressionBindings.Add(New ExpressionBinding() With {.PropertyName = "Text", .Expression = "[calculatedField]"})
' ...
private void calculatedField_GetValue(Object sender, GetValueEventArgs e)
    Dim row As IRow = TryCast(e.Row, IRow)
    Dim columnValue As Object = row("OrderDate")
    e.Value = CInt(DirectCast(columnValue, Date).DayOfWeek)

See Also

GetValue

GetValueEventArgs Class

GetValueEventArgs Members

DevExpress.XtraReports.UI Namespace