NullReferenceException when creating FileManagerEvents at version 18.4.0.39

From this example

https://www.syncfusion.com/forums/152443/blazor-filemanager-full-example

I upgrade to Syncfusion.Blazor 18.4.0.39 and modified the code as below and got NullReferenceException:

<SfFileManager TValue="FileManagerDirectoryContent" RootAliasName="Root Folder" @ref="file">
<FileManagerEvents TValue="string" ToolbarItemClicked="ToolbarClick"></FileManagerEvents>
<FileManagerAjaxSettings Url="/api/Files/FileOperations"
GetImageUrl="/api/Files/GetImage"
UploadUrl="/api/Files/Upload"
DownloadUrl="/api/Files/Download">
</FileManagerAjaxSettings>
<FileManagerToolbarSettings Items="@ToolbarItems"></FileManagerToolbarSettings>
</SfFileManager>
private SfFileManager<FileManagerDirectoryContent> file;
public string[] Items = new string[] { "Open", "|", "Delete", "Download", "Rename", "|", "Details", "Custom" };
public string[] ToolbarItems = new string[] {"NewFolder", "Upload", "Delete", "Download", "Rename", "SortBy", "Refresh", "Selection", "View", "Details", "Custom"};
public async Task ToolbarClick(ToolbarClickEventArgs<string> args)
{

}


1 Reply 1 reply marked as answer

SS Sharon Sanchez Selvaraj Syncfusion Team March 8, 2021 12:33 PM UTC

Hi Thinh, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked with your code and noticed that the proper TValue is not updated for the FileManager events.  
 
Please change the TValue of the event as shown below to proceed with your sample. 
 
<SfFileManager TValue="FileManagerDirectoryContent" RootAliasName="Root Folder" @ref="file"> 
    <FileManagerEvents TValue="FileManagerDirectoryContent" ToolbarItemClicked="ToolbarClick"></FileManagerEvents> 
                             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> 
    <FileManagerToolbarSettings Items="@ToolbarItems"></FileManagerToolbarSettings> 
</SfFileManager> 
 
In your @code block, 
 
public async Task ToolbarClick(ToolbarClickEventArgs<FileManagerDirectoryContent> args) 
    { 
 
    } 
 
 
Please let us know if you need further assistance. 
 
Regards, 
 
Sharon Sanchez S. 
 
 


Marked as answer
Loader.
Up arrow icon