How to: Export Images from a Column of the CardViewImageColumn Type

  • 3 minutes to read

The following example exports images displayed in the CardViewImageColumn. To export images, handle the RenderBrick event and populate its argument ImageValue property with an image in the binary format.

View Example

<table>
    <tr>
        <td style="padding-right: 4px">
            <dx:ASPxButton ID="btnPdfExport" runat="server" Text="Export to PDF" OnClick="btnPdfExport_Click" />
        </td>
        <td style="padding-right: 4px">
            <dx:ASPxButton ID="btnXlsExport" runat="server" Text="Export to XLS" OnClick="btnXlsExport_Click" />
        </td>
        <td style="padding-right: 4px">
            <dx:ASPxButton ID="btnXlsxExport" runat="server" Text="Export to XLSX" OnClick="btnXlsxExport_Click" />
        </td>
        <td style="padding-right: 4px">
            <dx:ASPxButton ID="btnRtfExport" runat="server" Text="Export to RTF" OnClick="btnRtfExport_Click" />
        </td>
        <td>
            <dx:ASPxButton ID="btnCsvExport" runat="server" Text="Export to CSV" OnClick="btnCsvExport_Click" />
        </td>
    </tr>
</table>  
<dx:ASPxCardView ID="CardView1" runat="server" AutoGenerateColumns="False" DataSourceID="XmlDataSource1">
    <Columns>
        <dx:CardViewTextColumn Caption="Common Name" FieldName="Common_Name" VisibleIndex="0">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn Caption="Species Name" FieldName="Species_Name" VisibleIndex="1">
        </dx:CardViewTextColumn>
        <dx:CardViewImageColumn Caption="Image" FieldName="ImagePath" VisibleIndex="2">
            <PropertiesImage ImageHeight="120px" ImageWidth="180px">
            </PropertiesImage>
        </dx:CardViewImageColumn>
    </Columns>
</dx:ASPxCardView>
<dx:ASPxCardViewExporter CardWidth="310" ID="CardViewExporter" CardViewID="CardView1" OnRenderBrick="ASPxCardViewExporter1_RenderBrick" runat="server"></dx:ASPxCardViewExporter>  
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Fishes.xml" />