[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Expand]Common Concepts
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
   Reporting
  [Expand]Charting
  [Expand]Pivot Grid
   Spreadsheet
   Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Collapse]Data Editors Extensions
    Editor List
    Main Features
   [Expand]Common Concepts
    BinaryImage
   [Expand]Button
    ButtonEdit
   [Expand]Calendar
   [Expand]Captcha
    CheckBox
    CheckBoxList
   [Expand]ColorEdit
   [Expand]ComboBox
   [Expand]DateEdit
   [Expand]DropDownEdit
    Filter Control
   [Expand]GridLookup
   [Expand]HyperLink
   [Expand]Image
   [Expand]Label
   [Expand]ListBox
   [Expand]Memo
   [Expand]Progress Bar
   [Expand]RadioButton
   [Expand]RadioButtonList
   [Expand]SpinEdit
   [Expand]TextBox
   [Expand]TimeEdit
   [Expand]TokenBox
   [Expand]TrackBar
    Validation Summary
   [Expand]Strongly-Typed Editor Types
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Extensions
  [Expand]SpellChecker
  [Expand]Query Builder
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

BinaryImage

BinaryImage is an editor capable of displaying images from a binary stream.

Expanded Implementation Details

BinaryImage is realized by the BinaryImageEditExtension class. Its instance can be accessed via the ExtensionsFactory.BinaryImage helper method, which is used to add a BinaryImage extension to a view. This method's parameter provides access to the BinaryImage's settings implemented by the BinaryImageEditSettings class, allowing you to fully customize the extension.

The BinaryImage's client counterpart is represented by the ASPxClientBinaryImage object.

Expanded Declaration

BinaryImage can be added to a view in the following manner.

Controller code:

View code - "ViewPage1" (Razor):

or

View code - "ViewPage1" (Razor):

Note

To enable the file downloading and uploading functionality, the Partial View with the extension must be wrapped with the HTML form. Since this functionality is implemented through the UploadControl extension, it's also necessary to fulfill all the recommendations from the corresponding KB article.

Note

The Partial View should contain only the extension's code.

The code result is demonstrated in the image below.

Expanded Main Features

The BinaryImage MVC extension represents an editor capable of displaying images from a binary stream.

The BinaryImageEditSettings.ContentBytes property provides access to the editor's contents, represented by an array of bytes.

You can specify the text to display in place of image when the image is not available by setting the BinaryImageEditSettings.Properties.AlternateText (ASPxImageBase.AlternateText) property.

The BinaryImageEditSettings.Properties.EmptyImage (ASPxImageBase.EmptyImage) property allows you to define a specific image to be displayed by the image editor if the editor's value is null (or the ImageUrl property is not defined or is set to an empty string).

The alignment of the displayed image in relation to other elements on the web page is specified by the BinaryImageEditSettings.Properties.ImageAlign (ASPxImageBase.ImageAlign) property.

Is this topic helpful?​​​​​​​