Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

File Attachment Properties

  • 3 minutes to read

In XAF, the File Attachments Module provides the BLOB file attachment functionality.

The image below illustrates IFileData type business class properties.

Note

Refer to the Property Editors | File Attachment Properties section in the Feature Center demo installed with XAF to see File Attachment Property Editors in action. The Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 20.2\Components.NET Core Desktop Libraries\eXpressApp Framework\FeatureCenter by default. The ASP.NET Web Forms version of this demo is available online at https://demos.devexpress.com/XAF/FeatureCenter/.

Examples

WinForms Property Editors for File Attachment Properties

Each WinForms Property Editor has a control that displays a corresponding property in a Detail View, and a repository item that displays a property in a List Editor that supports in-place editing. Both the control and repository item are shown below.

FileDataPropertyEditor

Control: FileDataEdit - a ButtonEdit control descendant. The OpenFileDialog is used to attach a file.

Repository Item: RepositoryItemFileDataEdit - a descendant of the XtraEditors Library’s RepositoryItemButtonEdit repository item.

Description:

Used for properties of the types that implement the IFileData interface by default. For instance, the FileData type is a built-in type that implements this interface.

This Property Editor is contained in the File Attachments Module. It is used when this module is added to a WinForms application.

The Open, SaveTo and ClearContent Actions, which you can perform with the editor, represent FileAttachmentController Actions. Use the editor’s context menu to execute these Actions. Clicking the editor’s button or pressing Enter also executes the Open Action.

ASP.NET Property Editors for File Attachment Properties

Each ASP.NET Property Editor has controls that display a property in a Detail View‘s View and Edit mode (see DetailView.ViewEditMode). These controls are listed below.

FileDataPropertyEditor

View mode control: FileDataEdit control which uses the HtmlAnchor control to download the current file in the view mode.

Edit mode control: FileDataEdit control which uses the HtmlAnchor control to download the current file and the ASPxUploadControl to upload a new file in the edit mode. The Change File and Clear buttons are displayed using two ASPxButton controls.

Description:

Used for properties of the types that implement the IFileData interface by default. For instance, the FileData type is a built-in type that implements this interface.

This Property Editor is contained in the File Attachments Module. It is used when this module is added to an ASP.NET application. The FileDataPropertyEditor uses only the FileDataEdit control, which is generated in differently for the view, edit, and read-only modes.

The file representing the property’s value is displayed as a link and can be downloaded in the view mode. The Download operation represents the FileAttachmentController‘s Download Action. In an edit mode, the Edit and Clear operations are added to the download operation.

In the current implementation of the FileDataPropertyEditor, the upload progress is not shown in case the ImmediatePostDataAttribute is applied to the current FileData property or the IModelCommonMemberViewItem.ImmediatePostData option is enabled for the current View Item in Model Editor.