Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Custom Filter API

  • Create (F7)Create
  • Rename (F2)Rename
  • Move (F6)Move
  • CopyCopy
  • Delete (Del)Delete
  • RefreshRefresh
  • DownloadDownload
  •  
    ...
 
 
Name 
Date modified 
Size 
Contracts
9/20/2024 4:43:07 AMFolder
Projects
9/20/2024 4:43:07 AMFolder
Reports
9/20/2024 4:43:07 AMFolder
Requests
9/20/2024 4:43:07 AMFolder
Account information.docx
9/17/2024 7:03:22 AM1 B
Bill payment.xlsx
9/17/2024 7:03:06 AM1 B
Design.rtf
9/17/2024 7:03:06 AM1 B
Packing list.xlsx
9/17/2024 7:03:06 AM1 B
Purchase invoice.docx
9/17/2024 7:03:22 AM1 B
Upload

Allowed Extensions: .jpg, .jpeg, .gif, .rtf, .txt, .png, .doc, .docx, .pdf, .xls, .xlsx



The DevExpress ASP.NET MVC File Manager provides APIs allowing you to filter its file list programmatically in a custom manner. For instance, you can write code to display only certain files types (such as images, spreadsheets or rich text documents) or the most recently used files.

To implement custom filters, you need to manually obtain the required files from your file system provider. Use the following APIs for this purpose.

  • The MVCxFileManager.FileListCustomFilter property.
    Specify the name of your custom filter to be currently applied to the File Manager's file list. Use this property to identify the active filter among all named custom filters you implement.
  • The MVCxFileManager.FileListCustomFilterBreadcrumbsText property.
    Optionally, specify the breadcrumbs text to be displayed in the File Manager for the applied filter.
  • The FileSystemProviderBase.GetFilteredItems method.
    Override this method within your file system provider to provide implementations of all custom filters to be used in the File Manager. This method has a parameter of the FileManagerGetFilteredItemsArgs type whose properties allow you to identify the filter, determine its additional characteristics and return file items matching the filter.
  • The FileManagerGetFilteredItemsArgs object's properties:

    • FileListCustomFilter - Gets the active filter's name (specified by the File Manager's FileListCustomFilter property).
    • FilterBoxText - Gets the search string entered into the File Manager's filter box.
    • Folder - Gets the File Manager's currently active folder.
    • Items - Specifies a collection of file items (FileManagerFile or FileManagerFolder instances) that match the applied filter.

This demo illustrates how to implement custom filters - in the demo they are 'Recent', 'RTF Docs', 'Sheets', 'Images', 'PDFs', and 'Favorites'. They allow end-users to filter the File Manager's file list by a certain criterion and to search within the applied filter using the filter box.

Note that in this demo, custom filters' UI is implemented using the Menu extension that is displayed instead of the File Manager's folder list view. Each menu item identifies the corresponding custom filter by its name. Clicks on menu items are processed on the client side to initiate the File Manager's custom callback passing the clicked item's name to the server (through the PerformCallback client-side method). On the server side, in the Controller action specified by the FileManagerSettings.CustomActionRouteValues property, this name (identifying the filter to apply) is passed to the File Manager's partial view through ViewData, and a collection of filtered items is passed to the partial view as a Model. Implementation of individual custom filters is given in the CustomFileSystemProvider class that inherits functionality from the standard PhysicalFileSystemProvider and overrides the FileSystemProviderBase.GetFilteredItems method.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxFileManagerAndUploadDemos