Skip to content

Bind DevExtreme FileManager to a default file system provider.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-core-razor-pages-file-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Manager for ASP.NET Core - How to use file manager in ASP.NET Core Razor Pages

This example demonstrates the DevExtreme FileManager control bound to a default file system provider. The page handler methods work on the backend.

Implementation Details

  1. Add required libraries to your project. See the following topic for more details: Configure a Visual Studio Project.

  2. Add the FileManager control to your Razor Page and specify the Remote provider.

    @(Html.DevExtreme().FileManager()
        .FileSystemProvider(provider =>
            provider.Remote()
            .Url(Url.Page("Index", "Documents")))
  3. File Manager uses both GET and POST requests, so it is necessary to create handlers for both request types.

    public IActionResult OnGetDocuments(FileSystemCommand c, string a) => ProcessFileApiRequest(c, a);
    public IActionResult OnPostDocuments(FileSystemCommand c, string a) => ProcessFileApiRequest(c, a);
  4. Process requests with PhysicalFileSystemProvider as demonstrated in the following demo: Physical File System.

    All data operations except Download return JSON data. Return the result in the handler as follows:

    return command == FileSystemCommand.Download ? (IActionResult)result : new JsonResult(result);
  5. Use the IgnoreAntiforgeryTokenAttribute object to disable AntiForgeryToken on the Razor Page with File Manager.

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)