excluding using Configuration

5 posts, 0 answers
  1. Sunil
    Sunil avatar
    5 posts
    Member since:
    Sep 2012

    Posted 04 Feb 2013 Link to this post

    I have my RadFileExplorer working great, but how can I exclude specifics from the list? 

    I use RadFileExplorer.Configuration.SearchPatterns to find jpegs and RadFileExplorer.Configuration.ViewPaths to display the correct folder of jpegs (which I then display in RadImageEditor upon a click from the user), but within the correct folder there is an additional folder that I do not want to be shown in the RadFileExplorer. It's a backup folder, and there's no need for the end-user to see it along with the rest of the jpegs, I only want the user to see the jpegs. Is there a way that I can exclude the folder from showing up? Thanks.
  2. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 05 Feb 2013 Link to this post

    Hi Sunil,

    The following demo shows a way to achieve the desired scenario: Filter files and download. I hope examining it thoroughly will allow you to integrate the logic in your code. The demo's description provides extensive information on the case.

    Please, feel free to contact us if we could be of any further assistance.

    Kind regards,
    Vesi
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sunil
    Sunil avatar
    5 posts
    Member since:
    Sep 2012

    Posted 05 Feb 2013 Link to this post

    Is all of this overriding necessary? I just want to exclude one folder from the user's view. 

    In other words, to include only jpegs with a certain file name from a specific folder, all I had to do was 2 lines of code.
            FileExplorer1.Configuration.SearchPatterns = new string[] { "*PAGEIMAGE*.jpg"};
            FileExplorer1.Configuration.ViewPaths = new string[] { "~/images" };

    So if I want to make just one folder called "backup" invisible from the user, will it really be that involved? I was expecting a quick fix. However, if studying that example is necessary, I will do it.

    Just let me know.
    Thanks.
      
  5. Sunil
    Sunil avatar
    5 posts
    Member since:
    Sep 2012

    Posted 06 Feb 2013 Link to this post

    I'll submit a support ticket instead. 
  6. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 06 Feb 2013 Link to this post

    Hi Sunil,

    I have just answered your support ticket on the subject, but for convenience I am pasting my answer here as well:

    I am afraid to say that the only way to exclude a folder from the FileExplorer ViewPaths is to override the ResolveRootDirectoryAsTree() method by subclassing the existing FileSystemContentProvider.

    For your conveninece I have isoated the project from the demo as much as possible, so you could see only the code needed for hiding folders.

    private bool IsFiltered(string name)
    {
        if (name.ToLower().StartsWith("backup")) //or (name.ToLower().Contains("backup"))
        {
            return true;
        }
     
        // else
        return false;
    }

    I hope this was helpful for you.

    Kind regards,
    Vesi
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017