ASPxCardViewExportRenderingEventArgs.BrickStyle Property
Gets the style settings used to paint report bricks.
Namespace: DevExpress.Web
Assembly:
DevExpress.Web.v20.2.dll
NuGet Package:
DevExpress.Web
Declaration
public BrickStyle BrickStyle { get; }
Public ReadOnly Property BrickStyle As BrickStyle
Property Value
Use the BrickStyle property to specify the appearance of report bricks. You can specify the foreground, background and border colors for bricks, the font, border side settings and text formatting information.
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’.
View Example
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)
{
ASPxCardViewExporter1.WritePdfToResponse();
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
<Columns>
<dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitPrice" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsInStock" VisibleIndex="2">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsOnOrder" VisibleIndex="3">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="ProductID" ReadOnly="True" Visible="False">
</dx:CardViewTextColumn>
</Columns>
</dx:ASPxCardView>
<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:ASPxCardViewExporter>
<dx:ASPxButton ID="ASPxButton1" AutoPostBack="false" OnClick="ASPxButton1_Click" runat="server" Text="Export to PDF"></dx:ASPxButton>
</div>
</form>
</body>
</html>
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
<Columns>
<dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="0">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitPrice" VisibleIndex="1">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsInStock" VisibleIndex="2">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="UnitsOnOrder" VisibleIndex="3">
</dx:CardViewTextColumn>
<dx:CardViewTextColumn FieldName="ProductID" ReadOnly="True" Visible="False">
</dx:CardViewTextColumn>
</Columns>
</dx:ASPxCardView>
<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:ASPxCardViewExporter>
<dx:ASPxButton ID="ASPxButton1" AutoPostBack="false" OnClick="ASPxButton1_Click" runat="server" Text="Export to PDF"></dx:ASPxButton>
</div>
</form>
</body>
</html>
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DevExpress.Web
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub ASPxCardViewExporter1_RenderBrick(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxCardViewExportRenderingEventArgs)
Dim dataColumn As CardViewColumn = TryCast(e.Column, CardViewColumn)
If dataColumn IsNot Nothing AndAlso dataColumn.FieldName = "ProductName" Then
e.BrickStyle.ForeColor = If(CDec(e.GetValue("UnitPrice")) > 10, Color.Green, Color.Red)
e.BrickStyle.BackColor = Color.LightYellow
End If
End Sub
Protected Sub ASPxButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
ASPxCardViewExporter1.WritePdfToResponse()
End Sub
End Class
See Also