Cannot hide "New folder" and "Open" in folder context menu
Hi
in the event "MenuOpened" I try to hide "New folder" and "Open" for certain folders.
"Open" is Disabled but not hidden and "New folder" remains enabled and visible
In my code I want to hide all menu items except "Details".foreach (var menuItem in args.Items)
foreach (var menuItem in args.Items) { menuItem.Hidden = menuItem.Text != "Details"; }
The above code works for all menu items but not for "New folder" and "Open"
Regards, Bruno
Regards,
Prasanth Madhaiyan.
Hi Prasanth
Thank you for going to fix the bug!
For my scenario it would be very advantageous if the layout, file, and folder menu items could be loaded dynamically.
I tried this in MenuOpened, but it didn't work.
Can you provide me with sample code?
Regards,
Bruno
- Hide menu items using the Hidden property
- Disable menu items using the Disabled property
- Hide the "Cut" option when the selected folder is "Pictures"
- Hide the "Details" option when the selected file is "snow.jpg"
- Hide the "Paste" option when the context menu is opened on the layout
... <SfFileManager TValue="FileManagerDirectoryContent" @ref="FileManager"> ..... <FileManagerContextMenuSettings File="@FileItems" Folder="@FolderItems" Layout="@LayoutItems"></FileManagerContextMenuSettings> <FileManagerEvents TValue="FileManagerDirectoryContent" MenuOpened="OnMenuOpened"></FileManagerEvents> </SfFileManager> @code { SfFileManager<FileManagerDirectoryContent>? FileManager; public string[] FileItems = new string[] { "Delete", "Download", "Rename", "|", "Details" }; public string[] FolderItems = new string[] { "Open", "|", "Cut", "Copy", "Paste", "Delete", "Download" }; public string[] LayoutItems = new string[] { "Open", "|", "Cut", "Copy", "Paste", "New Folder", "Upload" }; public void OnMenuOpened(MenuOpenEventArgs<FileManagerDirectoryContent> args) { if(args.FileDetails[0].Name == "Pictures" && args.MenuType == "Folder") { foreach(var item in args.Items) { if(item.Text =="Cut") { item.Hidden = true; } } } if (args.FileDetails[0].Name == "snow.jpg" && args.MenuType == "File") { foreach (var item in args.Items) { if (item.Text == "Details") { item.Hidden = true; } } } if (args.MenuType == "Layout") { foreach (var item in args.Items) { if (item.Text == "Paste") { item.Hidden = true; } } } } } |
Regards,
Praveen Sellappan
Attachment: FileCM_d5137120.zip
Hi Bruno,
Thanks for your patience.
The issue “FileManager MenuOpened: Hidden and Disabled properties not applied consistently across context menu items” has been resolved in this release. To access this fix, we suggest you update the package to the latest version(33.2.15). We have also included the sample in the main version for your reference.
Root cause: The Hidden property was not applied consistently across all context menu rendering paths, causing items like "Open" to remain visible even when marked as hidden. Different menus used separate rendering logic that ignored the updated Hidden state. The Disable property failed because disabled items were stored using localized display text, while the UI checked against internal menu keys. This mismatch prevented items from being rendered as disabled.
Sample: Attached as a zip file.
Release Note: Essential Studio for Blazor Release Notes - v33.2.15
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Praveen Sellappan
Attachment: BlazorFileManager_4eca7094.zip
Hi Praveen
I tested the new version and found out that is still doesn't work for the folder items.
In menuOpened I hide all items to check the result.
New folder and Upload is still visible although Hidden is true.
I also have a strange effect with a custom item: When the name is 'Change Permission' it works. But when the name is 'ChangePermission' it works not and stays visible.
Please not that I use <NavigationTemplate> to render the folder view.
Best regards,
Bruno
Hidden property to true for the custom menu item "ChangePermission", hiding all menu items through the Hidden property, and hiding the New Folder and Upload menu items. In all these cases, the items were hidden correctly, and the behavior matched the intended functionality. We have attached a sample video demonstrating these scenarios for your reference.Attachment: contextmenu_31f561cd.zip
Hi Praveen
I cleared both caches but the problem still exists.
in MenuOpened I set:
foreach (var item in args.Items) { item.Hidden = true; item.Disabled = false; } return;
Checking Dev tools elements:
<li role="menuitem" tabindex="-1" aria-label="New folder" class="e-menu-item" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_newfolder"><span class="e-menu-icon e-icons e-fe-newfolder"></span>New folder</li>
<li role="menuitem" tabindex="-1" aria-label="New Model" class="e-menu-item e-menu-hide e-blankicon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_new model" style="padding-left: 38px;">New Model</li>
<li role="menuitem" tabindex="-1" aria-label="Upload" class="e-menu-item e-menu-caret-icon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_upload" aria-haspopup="true" aria-expanded="false"><span class="e-menu-icon e-icons e-fe-upload"></span>Upload<span class="e-icons e-caret"></span><span class="e-icons e-caret"></span></li>
<li role="menuitem" tabindex="-1" aria-label="ChangePermission" class="e-menu-item e-blankicon" id="filemanager-e95363b0-2760-4031-8ecd-53f071ce4807_cm_changepermission" style="padding-left: 38px;">ChangePermission</li>
The three items do not have e-menu-hide like at "New Model" which is really invisible.
Attached my razor file (without the partial class)
Attachment: FileManagerDialog_b967bd74.zip
Hi Praveen
I also checked your flat data sample where hiding all menu items works well.
I see a diference in the Dev Tools elements: In your sample I can not see any menu items at all. So it does not create any html code for hidden items.
Regards, Bruno
Hi Praveen
In your video you only checked the large item view but not the folder view where the problem exists.
All works well in the large item view.
Regards, Bruno
Hi Bruno,
enuOpened event customization that you provided. During our testing, all menu items were hidden from the UI as expected.- Context menu opening on a folder in Navigation Pane
- Context menu opening on a folder in Large Icons view
- Context menu opening on a file in Large Icons view
- Context menu opening on the layout area in Large Icons view
- Context menu opening on a folder in Details view
- Context menu opening on a file in Details view
- Context menu opening on the layout area in Details view
- Are you able to reproduce the issue using the sample we have attached?
- Do you notice any differences between your implementation and the sample we shared?
- Please ensure that all Syncfusion packages are updated to the latest version.
- Share a video recording demonstrating the issue so that we can further investigate it.
Regards
Praveen
Attachment: Sample_8713f7ff.zip
Hi Praveen
Thanks for your sample, which allowed me to run a few tests.
One reason for the problem is that I hide the items after the null check:
private async Task MenuOpened(MenuOpenEventArgs<SoFileManagerDirectoryContent> args) { var fileOrFolder = args.FileDetails?.FirstOrDefault(); if (fileOrFolder == null) return; foreach (var item in args.Items) { item.Hidden = true; item.Disabled = false; } }
But there's is another problem, also in your sample:
When I add "Upload":
FolderItems = new string[] { "Cut", "Copy", "Paste", "Delete", "Rename", "Properties", "ChangePermission", "Open", "Upload"};
Upload item does not hide.
But when I add "upload" it works.
It depends on capitalization or "Upload" is handled differently by the component.
Best regards,
Bruno
Hi Bruno,
Hi Bruno,
Thanks for your patience.
We are pleased to inform you that our weekly patch release has been successfully rolled out, and the issue "Upload menu item is not hidden when properties are updated dynamically in Blazor FileManager" has been resolved in this release.
Sample: Attached as a zip file.
Release Notes: Essential Studio for Blazor Release Notes - v34.1.30
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Praveen Sellappan
Attachment: FileManager_abbae493.zip
- 13 Replies
- 3 Participants
-
BR Bruno
- Jun 3, 2026 10:30 AM UTC
- Jul 10, 2026 02:47 PM UTC