All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

XRCrossTabCell.GetCurrentFieldValue(String) Method

Gets the current value of the specified data source field.

Namespace: DevExpress.XtraReports.UI.CrossTab

Assembly: DevExpress.XtraReports.v20.1.dll

Declaration

public object GetCurrentFieldValue(
    string name
)
Public Function GetCurrentFieldValue(
    name As String
) As Object

Parameters

Name Type Description
name String

The name of the data field to obtain the value from.

Returns

Type Description
Object

The current value of the specified data source field. If the specified field was not found, this method returns null (Nothing in Visual Basic).

Remarks

Call the GetCurrentFieldValue method in the XRCrossTabCell.BeforePrint event handler to obtain the current value of the specified data source field. If you do not want to cast the returned object, use the GetCurrentColumnValue<T> method, which returns a strongly typed object.

Examples

This example demonstrates how to handle a Cross Tab cell's BeforePrint event and customize the cell's appearance based on its current value and row index.

using System.Drawing;
using DevExpress.XtraReports.UI.CrossTab;
// ...
private void xrCrossTabCell3_BeforePrint(object sender, CrossTabCellPrintEventArgs e) {
    // Obtain the current cell.
    XRCrossTabCell cell = (XRCrossTabCell)sender;

    // Change the cell's foreground color if its value exceeds 3000.
    decimal value = cell.GetCurrentFieldValue<decimal>("Extended Price");
    if (value > 3000)
        cell.ForeColor = Color.Red;
    else cell.ForeColor = Color.Black;

    // Apply different background colors to odd and even rows.
    if (e.GroupRowIndex % 2 == 0)
        cell.BackColor = Color.LightCyan;
    else cell.BackColor = Color.White;
}

See Also