How to get the name and path of the File being deleted in Blazor File Manager

Answer:

We can get the name and path of the File being deleted in FileManager by using bindSelectedItems and Path properties on OnSend event of File Manager component.
Refer the below code snippet.

@using Syncfusion.Blazor.FileManager;

<SfFileManager @ref="filemanager" TValue="FileManagerDirectoryContent" @bind-SelectedItems="selectedItems">

<FileManagerEvents TValue="FileManagerDirectoryContent" OnSend="onOnSend">FileManagerEvents>

<FileManagerAjaxSettings Url="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/FileOperations"

UploadUrl="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Upload"

DownloadUrl="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/Download"

GetImageUrl="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/GetImage">

FileManagerAjaxSettings>

SfFileManager>

@code{

SfFileManager filemanager;

public string[] selectedItems { get; set; }

public void onOnSend(BeforeSendEventArgs args)

{

if (args.Action == "delete")

{

Console.WriteLine("Delete Event triggered");

//Returns the deleted file or folder name

Console.WriteLine(selectedItems);

//Returns the deleted file or folder path

Console.WriteLine(this.filemanager.Path);

}

}

}



Loader.
Up arrow icon