This is a migrated thread and some comments may be shown as answers.

Hiding stuff in the FileTree's Contect Menu

1 Answer 66 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 06 Apr 2020, 05:47 PM

I have a permission system that I’m using for my RadFileExplorer and Hiding various menu items and buttons. The problem is the options appear to be loading in some cases after the RadFileExplorer’s ExplorerPopulated, ItemCommand, and Prerender.

I am doing something like the following to remove the item:

if (((RadFileExplorer)(sender)).GridContextMenu.Items.Any(d => d.Value == "Rename"))
       {
           ((RadFileExplorer)(sender)).GridContextMenu.Items.Remove(((RadFileExplorer)(sender)).GridContextMenu.Items.First(d => d.Value == "Rename"));
       }

Similar code is working for the File Grid, but I can’t seem to get server code to apply to the FileTree, can I attach this code to the prerender the FileTree? Or does this disappear? DO I have to do this on the client side?

I’ve tried attaching to the PreRender of the FileTree and the FileTree’s Context Menu’s prerender, But I’m guessing that stuff gets overridden.  At what point should I try to reattach these PreRender Overrides?

Or better yet is there an easier way of removing the FileTree’s Context menu’s specific items?

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 09 Apr 2020, 01:56 PM

Hi Richard,

The delete/upload/rename functionality of RadFileExplorer are dependent on the permissions set to a given folder (through the set Upload/DeletePaths) and this is why RadFileExplorer often checks for their availability. For example, such check is made when a new folder is loaded and if the renaming in it is allowed, the Rename command is added to the control's context menus.

What you can try is removing the desired buttons on each Page_Load():

    protected void Page_Load(object sender, EventArgs e)
    {
        if (RadFileExplorer1.GridContextMenu.Items.Any(d => d.Value == "Rename"))
        {
            RadFileExplorer1.GridContextMenu.Items.Remove(RadFileExplorer1.GridContextMenu.Items.First(d => d.Value == "Rename"));
        }
    }

 


Vessy
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
FileExplorer
Asked by
Richard
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or