Skip to main content
A newer version of this page is available. .
Tab

ASPxBinaryImage.ContentBytes Property

Gets or sets an array of the bytes representing the image.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

[DefaultValue(null)]
public virtual byte[] ContentBytes { get; set; }

Property Value

Type Default Description
Byte[] *null*

A Byte array that contains the image’s contents.

Remarks

The example below demonstrates how to use the ASPxBinaryImage.ContentBytes property.

<dxwe:ASPxBinaryImage ID="biImage" runat="server">
</dxwe:ASPxBinaryImage>

<dxwuc:ASPxUploadControl runat="server" ID="ucImageUpload" 
    ClientInstanceName="ucImageUpload" 
    onfileuploadcomplete="ucImageUpload_FileUploadComplete">
    <ValidationSettings AllowedFileExtensions=".jpg,.jpe,.jpeg,.gif">
    </ValidationSettings>
</dxwuc:ASPxUploadControl>

<dxwe:aspxbutton id="btnUpload" runat="server" autopostback="False" text="Upload">
    <ClientSideEvents Click="function(s, e) { ucImageUpload.UploadFile(); }" />
</dxwe:aspxbutton>

<dxwe:aspxbutton id="btnApply" runat="server" text="Apply image from session" 
    onclick="btnApply_Click">
</dxwe:aspxbutton>
protected void ucImageUpload_FileUploadComplete
(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) {
    UploadedFile uploadFile = ucImageUpload.UploadedFiles.Length == 0 ? 
        null : ucImageUpload.UploadedFiles[0];
    Session["UploadedImageBytes"] = uploadFile.FileBytes;
}
protected void btnApply_Click(object sender, EventArgs e) {
    biImage.ContentBytes = (byte[])Session["UploadedImageBytes"];
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ContentBytes 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