Skip to main content
Tab

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

public byte[] ImageValue { get; set; }

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:

For other column types, the ImageValue property returns null.

Images rendered in the GridViewDataImageColumn column are not exported. Handle the ExportRenderBrick event and assign the image to the ImageValue property to implement image export. Note that the ExportRenderBrick event does not fire in DataAware export mode, so you should set the export mode to WYSIWIG.

Run Demo: Export with Data Cell Bands

<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" DataSourceID="XmlDataSource1" 
    OnExportRenderBrick="grid_ExportRenderBrick">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="Common_Name" Caption="Common name" />
        <dx:GridViewDataTextColumn FieldName="Species_Name" Caption="Species name" />
        <dx:GridViewDataImageColumn FieldName="ImagePath" Caption="Image">
            <PropertiesImage>
                <ExportImageSettings Width="180" Height="120" />
            </PropertiesImage>
        </dx:GridViewDataImageColumn>
    </Columns>
    <%--...--%>
</dx:ASPxGridView>
byte[] GetImageBinaryData(string relativePath) {
    string path = Server.MapPath(relativePath);
    return File.Exists(path) ? File.ReadAllBytes(path) : null;
}

protected void grid_ExportRenderBrick(object sender, ASPxGridViewExportRenderingEventArgs e) {
    var dataColumn = e.Column as GridViewDataColumn;
    if (dataColumn != null && dataColumn.FieldName == "ImagePath" && e.RowType == GridViewRowType.Data)
        e.ImageValue = GetImageBinaryData(e.Value.ToString());
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ImageValue property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also