ASPxBinaryImage.ContentBytes Property
Gets or sets an array of the bytes representing the image.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v23.1.dll
NuGet Package: DevExpress.Web
Declaration
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"];
}
Online Example
See Also