Skip to main content
Tab

ASPxCardViewExportRenderingEventArgs.GetValue(String) Method

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.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 card’s key value and handle are returned by the ASPxCardViewExportRenderingEventArgs.KeyValue and ASPxCardViewExportRenderingEventArgs.VisibleIndex properties, respectively. The processed cell’s value is returned by the ASPxCardViewExportRenderingEventArgs.Value property.

Example

This example conditionally applies a style to 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, the company names are painted in ‘red’.

<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" 
    DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
    <Columns>
        <dx:CardViewTextColumn FieldName="ProductName" />
        <dx:CardViewTextColumn FieldName="UnitPrice" />
        <dx:CardViewTextColumn FieldName="UnitsInStock" />
        <dx:CardViewTextColumn FieldName="UnitsOnOrder" />
        <dx:CardViewTextColumn FieldName="ProductID" Visible="False" />
    </Columns>
</dx:ASPxCardView>
<dx:ASPxCardViewExporter ID="ASPxCardViewExporter1" runat="server" CardViewID="ASPxCardView1"
                         OnRenderBrick="ASPxCardViewExporter1_RenderBrick" />
<dx:ASPxButton runat="server" ID="ASPxButton1" AutoPostBack="false" 
               OnClick="ASPxButton1_Click" Text="Export to PDF" />
protected void ASPxCardViewExporter1_RenderBrick(object sender, DevExpress.Web.ASPxCardViewExportRenderingEventArgs e) {
    CardViewColumn dataColumn = e.Column as CardViewColumn;
    if (dataColumn != null && dataColumn.FieldName == "ProductName") {
        e.BrickStyle.ForeColor = (decimal)e.GetValue("UnitPrice") > 10 ? Color.Green : Color.Red;
        e.BrickStyle.BackColor = Color.LightYellow;
    }
}
protected void ASPxButton1_Click(object sender, EventArgs e) {
    ASPxCardViewExporter1.WritePdfToResponse();
}
See Also