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

FileExplorer add Menu Item on Files to add permission

6 Answers 64 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Jahangeer
Top achievements
Rank 1
Jahangeer asked on 03 Dec 2015, 12:03 PM

Hi,

 Can I add custom MenuItem "Add Permission" to Folder or File of FileExplorer?? and on Click on that Menu Item I want to open a popup or new Window where I can pass the ItemID as querystring or something of selected Folder. Here is my code

 

<telerik:RadFileExplorer VisibleControls="TreeView,Toolbar,ListView,Grid,FileList,ContextMenus"
                runat="server" ID="RadFileExplorer1"   OnClientItemSelected="OnClientItemSelected"
                EnableOpenFile="true">
            </telerik:RadFileExplorer>

 protected void Page_Load(object sender, System.EventArgs e)
   {

       RadFileExplorer1.Configuration.SearchPatterns = new string[] { "*.jpg", "*.jpeg"};
       RadFileExplorer1.Configuration.ContentProviderTypeName = typeof(DBContentProvider).AssemblyQualifiedName;
       RadFileExplorer1.Configuration.ViewPaths = new string[] { "Files" };
       RadFileExplorer1.Configuration.UploadPaths = new string[] { "Files" };
       RadFileExplorer1.Configuration.DeletePaths = new string[] { "Files" };
   }

 

6 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 03 Dec 2015, 12:33 PM
Hi Jahangeer,

Yes, you can add a custom button to the FileExplorer's context menu and execute your custom logic when it is clicked. More details are available in the following help article: Adding Custom Command Buttons

As for the accessing the currently selected folder, you can use the FileExplorer's get_selecteditem() method like follows:
$find("RadFileExplorer1").get_selectedItem();

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jahangeer
Top achievements
Rank 1
answered on 04 Dec 2015, 07:31 AM
Hey Vessy Thanks for your reply Custom button added but your code is not working for getting selected value of FolderID that is ItemID from Items table it say "Cannot read property 'get_selectedItem' of null" as you know I want to get ID binded from DB as in this example  http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/server-sideapi/dbfilebrowsercontentprovider/defaultcs.aspx
0
Jahangeer
Top achievements
Rank 1
answered on 04 Dec 2015, 11:18 AM

I mange to remove the error using

 var test = $find("<%= RadFileExplorer1.ClientID %>").get_selectedItem();

but, didn't get the ItemID from binded folder value :(

0
Vessy
Telerik team
answered on 04 Dec 2015, 01:51 PM
Hi Jahangeer,

I am afraid that RadFileExplorer does not know about the custom data base fields and so it is not included into the data binding the FileExplorer's file and data items. The only approach I can suggest you is to create a custom RadGrid column in FileExplorer and bind it with the ItemID data. You can see how to implement such logic here:
FileExplorer - Add custom columns

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jahangeer
Top achievements
Rank 1
answered on 04 Dec 2015, 02:57 PM

Don't want to get that long.... can you please tell me one thing how to get url or path of selected node in javascript here is my code 

 

 RadMenuItem customMenuOption = new RadMenuItem("custom");
       customMenuOption.Value = "custom_Menu";
       RadFileExplorer1.TreeView.ContextMenus[0].Items.Add(customMenuOption);
       RadFileExplorer1.TreeView.OnClientContextMenuItemClicked = "treeContextMenuClicked";

this code is on page_Load and in javascript 

  function treeContextMenuClicked(toolbar, args) {

//here I want to get path of selected item how to get??

}

0
Vessy
Telerik team
answered on 07 Dec 2015, 03:34 PM
Hi Jahangeer,

You can access the path of the active TreeView node inside the , over which the context menu is shown by getting its value like follows:
function treeContextMenuClicked(tree, args) {
     //get path of selected item
     var activeNodePath = args.get_node().get_value()
}

You can find more detailed information regarding the TreeView's OnClientContextMenuItemClicked event here: OnClientContextMenuItemClicked

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
FileExplorer
Asked by
Jahangeer
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Jahangeer
Top achievements
Rank 1
Share this question
or