More in this section

Forums / Developing with Sitefinity / foldersNavigation.RootFolder

foldersNavigation.RootFolder

7 posts, 1 answered
  1. Marijn Rispens
    Marijn Rispens avatar
    11 posts
    Registered:
    24 Sep 2009
    24 Sep 2009
    Link to this post
    Hi there, i've got an issue regarding the RootFolder property in the Files section (admin area).
    What we wanted is to set an Rootfolder for every Role except Administrators.
    Therefor we've tried to set the "foldersNavigation.RootFolder" property. This results in an Page error "unknown virtual path".

    I've used the following code line:
    foldersNavigation.RootFolder = new System.IO.DirectoryInfo(MapPath("~/")); 

    Is there any way we can set the rootfolder to Files when the user is not an Administrator?

    Thanx!

     

  2. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    24 Sep 2009
    Link to this post
    Hi Marijn Rispens,

    You could give a try to the code shown below:

     foldersNavigation.RootFolderPath = "~/Sitefinity"

    Hope this helps.

    Regards,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Marijn Rispens
    Marijn Rispens avatar
    11 posts
    Registered:
    24 Sep 2009
    24 Sep 2009
    Link to this post
    Hi Nikolai

    That's ... well, allmost embarrassing easy ...

    So, now we've got this working, but, when users are in a higher level folder, they still have the abilility to use the button "Folder Up". Is there any way we can control this button? say, to disable it when the wanted root folder is reached?

    Thanx so much for the fast reply!

    Regards
    Marijn Rispens
    GemeenteWeb (Holland)
  4. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    25 Sep 2009
    Link to this post
    Hello Marijn Rispens,

    I suggest you doing this:
    1. Add an <input type="hidden" runat="server" id="flagForUploadButton" value="false" /> element in the Files.aspx page
    2. Then set the value to true on the server if the person is admin:
    this.flagForUploadButton.Value = "true"

    3. Add and call JavaScript function on the client to hide the button if the person is not admin:
    <input type="hidden" id="flagForUploadButton" value="true" runat="server"/> 
    <script type="text/javascript"
        this.Hide(); 
        function Hide() { 
            var flag = $get("<%=flagForUploadButton.ClientID%>"); 
             
            if(flag.value == "false"){ 
                var folderUpButton = $get("ctl00_ContentPlaceHolder1_fileManager_ctl00_ctl00_folderUpButton"); 
                folderUpButton.style.visibility = "hidden"
            } 
        } 
     
    </script> 
    </asp:Content> 

    Kind regards,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Marijn Rispens
    Marijn Rispens avatar
    11 posts
    Registered:
    24 Sep 2009
    28 Sep 2009
    Link to this post
    Hi NIkolai

    Thanks you. This wil do the trick.
    I was hoping you knew if that button is also availible through methods from the code behind.

    Thanks

    Regards
    Marijn Rispens
    GemeenteWeb (Holland)
  6. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    01 Jun 2017
    28 Sep 2009
    Link to this post
    Hello Marijn Rispens,

    You can try this:
     var fileUpButton = this.fileManager.Controls[0].Controls[0].Controls[2].Controls[0];         

    to get to the button via the code-behind.

    Greetings,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  7. Marijn Rispens
    Marijn Rispens avatar
    11 posts
    Registered:
    24 Sep 2009
    29 Sep 2009
    Link to this post
    Hi Nikolai

    Thank you for the support.
    The information above is just what we needed!

    Kind regards,
    Marijn Rispens
Register for webinar
7 posts, 1 answered