Skip to main content

ASPxCardViewExporter.RenderBrick Event

Enables rendering of different content from the default export.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v22.2.dll

NuGet Package: DevExpress.Web


public event ASPxCardViewExportRenderingEventHandler RenderBrick

Event Data

The RenderBrick event's data class is ASPxCardViewExportRenderingEventArgs. The following properties provide information specific to this event:

Property Description
BrickStyle Gets the style settings used to paint report bricks.
Column Gets a data column that corresponds to the processed grid element.
ImageValue Gets or sets an array of bytes that contains the processed brick’s image.
KeyValue Gets the processed card’s key.
Text Gets or sets the text displayed within the brick currently being rendered.
TextValue Gets or sets the processed brick’s value.
Url Gets or sets the rendered brick’s URL.
Value Gets the processed data cell’s value.
VisibleIndex Gets the processed card’s visible index.

The event data class exposes the following methods:

Method Description
GetValue(String) Returns the value of the specified cell within the processed card.


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’.

View Example

<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" 
    DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
        <dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="0">
        <dx:CardViewTextColumn FieldName="UnitPrice" VisibleIndex="1">
        <dx:CardViewTextColumn FieldName="UnitsInStock" VisibleIndex="2">
        <dx:CardViewTextColumn FieldName="UnitsOnOrder" VisibleIndex="3">
        <dx:CardViewTextColumn FieldName="ProductID" ReadOnly="True" Visible="False">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" SelectCommand="SELECT [ProductName], [UnitPrice], [UnitsInStock], [UnitsOnOrder], [ProductID] FROM [Products]"></asp:SqlDataSource>
<dx:ASPxCardViewExporter ID="ASPxCardViewExporter1" OnRenderBrick="ASPxCardViewExporter1_RenderBrick" runat="server" CardViewID="ASPxCardView1">
<dx:ASPxButton ID="ASPxButton1" AutoPostBack="false" OnClick="ASPxButton1_Click" runat="server" Text="Export to PDF"></dx:ASPxButton>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e) {

    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) {
See Also