FileExplorer add Menu Item on Files to add permission

7 posts, 0 answers
  1. Jahangeer
    Jahangeer avatar
    19 posts
    Member since:
    Apr 2013

    Posted 03 Dec 2015 Link to this post

    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" };
       }

     

  2. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 03 Dec 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jahangeer
    Jahangeer avatar
    19 posts
    Member since:
    Apr 2013

    Posted 04 Dec 2015 in reply to Vessy Link to this post

    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
  5. Jahangeer
    Jahangeer avatar
    19 posts
    Member since:
    Apr 2013

    Posted 04 Dec 2015 in reply to Vessy Link to this post

    I mange to remove the error using

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

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

  6. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 04 Dec 2015 Link to this post

    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
  7. Jahangeer
    Jahangeer avatar
    19 posts
    Member since:
    Apr 2013

    Posted 04 Dec 2015 in reply to Vessy Link to this post

    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??

    }

  8. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 07 Dec 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017