Skip to main content
A newer version of this page is available. .

GetValueEventArgs.Value Property

Gets or sets a value of a calculated field.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

public object Value { get; set; }

Property Value

Type Description
Object

A Object representing a field’s value.

Remarks

Use the Value property in the CalculatedField.GetValue event handler to obtain the current value of a calculated field, and to assign a custom value when it is calculated.

Example

The report created in this example is bound to the “Orders” table of the sample Northwind database (the nwind.mdb file located in the directory where you installed DevExpress demos).

To sort records by days of the week at runtime, do the following.

  1. Create a calculated field with the CalculatedField.FieldType property set to String. Add a GroupHeader band, and add a grouping criteria (with the GroupField.FieldName property set to the created calculated field) to its GroupHeaderBand.GroupFields collection.
  2. Then, drop the calculated field from the Field List onto the GroupHeader1 band for the XRLabel control (named hdrLabel) bound to the field to be automatically created.
  3. Handle the calculated field’s CalculatedField.GetValue and the hdrLabel‘s XRControl.BeforePrint event handlers in the following way.
using System;
using System.Data;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...

private void calculatedField1_GetValue(object sender, GetValueEventArgs e) {
    object columnValue = e.GetColumnValue("OrderDate");
    e.Value = (int)((DateTime)columnValue).DayOfWeek;
}

private void hdrLabel_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    hdrLabel.Text = ((DayOfWeek)this.GetCurrentColumnValue(this.calculatedField1.Name)).ToString();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Value property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also