Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
I have a blazor server app that requires me to have the file manager rendered on multiple razor pages and assigned to different folders, so users have an individual razor page for each folder they have access to. I noticed that sometimes when I open switch from one razor page to another that has a file manager, it displays the parent folder and then quickly refreshes to the child folder it's assigned to open. I can not figure out why that is happening and I believe it is a bug.
@page "/Recents"
@using Syncfusion.Blazor.FileManager
@using System.Security.Claims
@inject AuthenticationStateProvider GetAuthenticationStateAsync
<PageTitle>Recents</PageTitle>
<h1 class="h1-Title">Recents</h1>
<AuthorizeView>
<Authorized>
<div class="fileManager">
<SfFileManager TValue="FileManagerDirectoryContent" Width="100%" RootAliasName=@path Path=@path AllowDragAndDrop="true">
<FileManagerNavigationPaneSettings Visible="false" ></FileManagerNavigationPaneSettings>
<FileManagerContextMenuSettings File="@Items" Folder="@Items"></FileManagerContextMenuSettings>
<FileManagerAjaxSettings Url="/api/SampleData/FileOperations"
DownloadUrl="/api/SampleData/Download"
UploadUrl="/api/SampleData/Upload"
GetImageUrl="/api/SampleData/GetImage">
</FileManagerAjaxSettings>
<FileManagerEvents TValue="FileManagerDirectoryContent" MenuOpened="MenuOpened" OnMenuClick="OnMenuClick">
</FileManagerEvents>
</SfFileManager>
</div>
</Authorized>
<NotAuthorized>
<p class="loginWarning">You need to be signed in.</p>
<div class="signIn" style="">
<form action="/Identity/Account/Login">
<input type="submit" value="Sign in" class="signInBtn"/>
</form>
</div>
</NotAuthorized>
</AuthorizeView>
<style>
.e-filemanager{
border: initial;
}
.e-toolbar .e-tbar-btn:active{
background-color: #00b2d6;
}
.e-toolbar .e-tbar-btn:hover{
background-color: rgba(0,212,255,1);
}
.e-toolbar .e-tbar-btn:focus{
background-color: rgba(0,212,255,1);
}
.e-filemanager .e-toolbar .e-toolbar-items .e-toolbar-item .e-dropdown-btn.e-btn.e-tbar-btn:hover {
background-color: rgba(0,212,255,1);
}
.e-dlg-overlay{
background: initial;
}
.e-filemanager .e-toolbar .e-toolbar-items .e-toolbar-item .e-dropdown-btn.e-btn.e-tbar-btn.e-active {
background-color: #00b2d6;
}
.e-filemanager .e-toolbar .e-toolbar-items .e-toolbar-item .e-dropdown-btn.e-btn.e-tbar-btn:focus {
background-color: rgba(0,212,255,1);
}
.e-filemanager .e-toolbar{
border: initial;
}
.e-toolbar{
background: initial;
}
.e-toolbar .e-toolbar-items.e-tbar-pos{
background: initial;
}
.e-filemanager .e-address{
border: initial;
}
.e-filemanager .e-address .e-address-list-item:nth-child(1) {
display: none;
}
.e-filemanager .e-address .e-address-list-item:nth-child(2) {
display: none;
}
.e-filemanager .e-address .e-address-list-item:nth-child(2) .e-icons {
display: none;
}
.e-filemanager .e-address .e-address-list-item:nth-child(3) .e-icons {
display: none;
}
</style>
@code {
SfFileManager<FileManagerDirectoryContent> FileManager = new SfFileManager<FileManagerDirectoryContent>();
public string[] Items = new string[] { "Open", "|", "Cut", "Copy", "Paste" , "|","Delete", "Rename", "Download", "|", "Details", "Share" };
string path;
protected override async Task OnInitializedAsync()
{
var authstate = await GetAuthenticationStateAsync.GetAuthenticationStateAsync();
var user = authstate.User;
string userId = user.FindFirstValue(ClaimTypes.NameIdentifier);
path = "/" + userId + "/Recents/";
}
void MenuOpened(MenuOpenEventArgs<FileManagerDirectoryContent> args)
{
for (var i = 0; i < args.Items.Count; i++)
{
if (args.Items[i].Id == this.FileManager.ID + "_cm_share")
{
args.Items[i].IconCss = "e-icons e-fe-tick";
}
}
}
void OnMenuClick(MenuClickEventArgs<FileManagerDirectoryContent> args)
{
if (args.Item.Text == "Share")
{
Console.WriteLine("Clicked custom");
}
}
}