views:

34

answers:

2

Greetings everyone, i just wanna ask.. how do i disable the right click property in a telerik file explorer... what i want to achieve particularly is to restrict the user from deleting a file or folder.. i managed to hide the delete in toolbar but not in the right click.. kindly help me out... thanks...

Below is the code i did for hiding the toolbar items.. but disabling the items in the right click.. that's my problem..

    Private Sub HideToolBarButtons()
    ' Hides toolbar buttons

    Me.FileExplorer1.ToolBar.Items.FindItemByValue("NewFolder").Visible = False
    Me.FileExplorer1.ToolBar.Items.FindItemByValue("Delete").Visible = False
    Me.FileExplorer1.ToolBar.Items.FindItemByValue("Upload").Visible = False
End Sub


Protected Overrides Sub OnLoadComplete(ByVal e As EventArgs)
    MyBase.OnLoadComplete(e)
    HideToolBarButtons()
End Sub
A: 

You might be able to iterate over the menu items in the context menu on the file explorer (assuming you have access to it). Then when you find the menu item for delete, you could try setting a combination of enabled/visible to false.

Tony Abrams
thanks for the quick response Tony... i edit my previous post.. to show you how i hide my toolbar items.. could you show me how exactly do i hide the items when i hit the right click button in my telerik file explorer? thanks
Kid
You might want to check out lingvomir's answer. I think that might have exactly what you are looking for.
Tony Abrams
+1  A: 

If you set the DeletePaths property in the file explorer's configuration to an empty array, the delete buttons will be removed automatically (the same is valid for the UploadPaths and upload button).

If you just want to remove the items from the context menus, then you can access those through the fileExplorer.GridContextMenu and fileExplorer.Tree.ContextMenus[0] respectively for the grid and tree components.

lingvomir
thanks for the response lingvomir... i understand the fileExplorer.GridContextMenu part so what i did was Me.FileExplorer1.GridContextMenu.FindItemByValue("Delete").Visible = False and it works like a charm... but in the treeview.. i don't know what to set so that the delete property will no be seen.. i'm stuck with Me.FileExplorer1.TreeView i dont know what to do next..
Kid
it should be the same for the treeview - Me.FileExplorer1.TreeView.ContextMenus(0).FindItemByValue("Delete").Visible = False
lingvomir