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

ASPxGridViewExportRenderingEventArgs.GetValue(String) Method

Returns the value of the specified cell within the processed row.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public object GetValue(
    string fieldName
)

Parameters

Name Type Description
fieldName String

A String value that specifies the name of the data source field.

Returns

Type Description
Object

An object that represents the specified cell’s value.

Remarks

The processed row’s key value and handle are returned by the ASPxGridViewExportRenderingEventArgs.KeyValue and ASPxGridViewExportRenderingEventArgs.VisibleIndex properties, respectively. The processed cell’s value is returned by the ASPxGridViewExportRenderingEventArgs.Value property.

Example

This example shows you how to draw company names in an exported document based on the number of products. Company names are painted in Green if the product count is greater than 1,000. Otherwise, company names are painted in Red.

The image below shows the result:

RenderBrick

using DevExpress.Web.Export;
using DevExpress.Web.ASPxGridView;

protected void grid_ExportRenderBrick(object sender, DevExpress.Web.ASPxGridViewExportRenderingEventArgs e) {
    GridViewDataColumn dataColumn = e.Column as GridViewDataColumn;
    if(e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.FieldName == "CompanyName") {
        e.BrickStyle.ForeColor = (decimal)e.GetValue("ProductAmount") > 1000 ? Color.Green : Color.Red;
        e.BrickStyle.BackColor = Color.LightYellow;
    }
}

protected void btn_Click(object sender, EventArgs e) {
    grid.ExportPdfToResponse();
}
See Also