ASPxCardViewExportRenderingEventArgs.ImageValue Property
Gets or sets an array of bytes that contains the processed brick’s image.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
Type | Description |
---|---|
Byte[] | An array of bytes that contains the processed brick’s binary image. |
Remarks
Use the ImageValue property to obtain and specify the processed brick’s image. The ImageValue property is in effect for the following column types:
- CardViewBinaryImageColumn - the ImageValue property returns an array of bytes that contains the processed brick’s image.
- CardViewImageColumn - the ImageValue property returns null. However, you can specify the binary image value to be exported.
For other column types, the ImageValue property returns null.
Example
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.
<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" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Fishes.xml" />
using DevExpress.Web;
public partial class _Default : System.Web.UI.Page
{
protected void ASPxCardViewExporter1_RenderBrick(object sender, DevExpress.Web.ASPxCardViewExportRenderingEventArgs e) {
var dataColumn = e.Column as CardViewColumn;
if (dataColumn != null && dataColumn.FieldName == "ImagePath")
e.ImageValue = GetImageBinaryData(e.Value.ToString());
}
protected void btnPdfExport_Click(object sender, EventArgs e) {
CardViewExporter.WritePdfToResponse();
}
protected void btnXlsExport_Click(object sender, EventArgs e) {
CardViewExporter.WriteXlsToResponse();
}
protected void btnXlsxExport_Click(object sender, EventArgs e) {
CardViewExporter.WriteXlsxToResponse();
}
protected void btnRtfExport_Click(object sender, EventArgs e) {
CardViewExporter.WriteRtfToResponse();
}
protected void btnCsvExport_Click(object sender, EventArgs e) {
CardViewExporter.WriteCsvToResponse();
}
byte[] GetImageBinaryData(string relativePath) {
string path = Server.MapPath(relativePath);
return File.Exists(path) ? File.ReadAllBytes(path) : null;
}
}
See Also