FileDialog to select a folder

18 posts, 2 answers
  1. Jason Bourdette
    Jason Bourdette avatar
    77 posts
    Member since:
    Jan 2010

    Posted 18 Jun 2010 Link to this post

    When using the FileExplorer control with a RadWindow as sort of FileDialog, is it possible to just select a folder path. I dont want to select a specific file, just a folder.


    Thanks
    Jason
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 21 Jun 2010 Link to this post

    Hi Jason,

    In order to provide the Folder select functionality (like the one demonstrated in FileSelector Demo) I suggest you to use an external button and not to use OnClientFileOpen event.

    For your convenience I have attached a sample project with the required functionality implemented.

    Sincerely yours,
    Dobromir
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jason Bourdette
    Jason Bourdette avatar
    77 posts
    Member since:
    Jan 2010

    Posted 28 Jun 2010 Link to this post

    thanks. that works good except:

    on my aspx page i have the function

    function OpenFileSelected(wnd, fileselected){
    var textbox = $get("<%= RadTextBox1.ClientID %>");
    textbox.value = fileselected;
    }

    So after the above function runs the value of the textbox does equal the folder path i selected, but the text doesnt display in the textbox. I click inside the textbox then the text apears.

    any ideas?

    thanks
  5. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 29 Jun 2010 Link to this post

    Hello Jason,

    When you use a RadTextBox, you need to use its textbox.set_value(fileselected)  method in order to change the text. Also, you have to use the $find() method instead of $get() one. $find is used in order to get reference to an AJAX enabled control.

    I hope this helps.

    Regards,
    Fiko
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Jason Bourdette
    Jason Bourdette avatar
    77 posts
    Member since:
    Jan 2010

    Posted 29 Jun 2010 Link to this post

    Another question about the RadWindow as a FileDialog.

    On my main page I have a RadcomboxBox and I want to pass the value of that comboBox to the FileDialog Rad Window. How to do this?

    In my main page I tried to change the:

    function OpenFileExplorerDialog()
    {
       var wnd = $find ( "<%= FileExplorer.ClientID %>");
       var combobox = $find ( "<%= RadComboBox1.ClientID %>");
       var path = "explorer.aspx?id=" + comboxbox.get_text();
       wnd._navigateURL = path;
       wnd.show();
    }

    when debugging I do get the correct value in path and _navigateURL, however the page_load event for explorer.aspx seems to only execute the first time the user opens the radwindow. If the user closes the radwindow, makes a change to the combobox and reopens the radwindow the radwindows doesnt get the correct value from the combobox.

    Thanks!!!!
  7. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 02 Jul 2010 Link to this post

    Hi Jason,

    In your case I recommend you to remove this line of the code:
    wnd._navigateURL = path;

    and replace it with this public method:
    wnd.setUrl(path);


    The behavior that you experience is the expected one, because by default RadWindow's ReloadOnShow property is set to false. In your case you need to set this property to true and in order to cause the RadWindow control to load its content page every time it is shown.

    I hope this helps.

    Greetings,
    Fiko
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  8. Miguel
    Miguel avatar
    25 posts
    Member since:
    Dec 2010

    Posted 17 Jan 2011 Link to this post

    Hi Fiko, is there a way to do this functionality in the server side?
    I want to select a folder and get the path in order to place it in a text box and then call a button that uses that path.

    Could you please help me out?

    Thanks!
    Miguel
  9. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 19 Jan 2011 Link to this post

    Hi Miguel,

    FileSelection functionality is entirely client-side and RadFileExplorer does not preserve information for the selected item upon postbacks. In order to pass the path of the selected folder on the server, I suggest you to store the value to a hidden filed.

    Regards,
    Dobromir
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  10. July
    July avatar
    205 posts
    Member since:
    Jul 2011

    Posted 30 Nov 2011 Link to this post

    It is posible limited only to show Folder?
    No show Files?---

    I need selected a Folder only!
  11. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 05 Dec 2011 Link to this post

    Hi Julieta,

    You can display only folders in the RadFileExplorer by overriding the ResolveDirecotory() method of the content provider and return DirectoryItem with empty array as files, e.g.:
    public override DirectoryItem ResolveDirectory(string path)
    {
       DirectoryItem originalFolder = base.ResolveDirectory(path);
       List<FileItem> noFilesFiles = new List<FileItem>();
     
       DirectoryItem newFolder = new DirectoryItem(originalFolder.Name, originalFolder.Location, originalFolder.FullPath, originalFolder.Tag, originalFolder.Permissions, noFilesFiles.ToArray(), originalFolder.Directories);
     
       return newFolder;
    }


    Best wishes,
    Dobromir
    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
  12. July
    July avatar
    205 posts
    Member since:
    Jul 2011

    Posted 05 Dec 2011 Link to this post

    Where i write this?
    According to example ,In Explorer.aspx ?
  13. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 07 Dec 2011 Link to this post

    Hi Julieta,

    Please accept my apologies for not being clear enough in my previous reply.

    The provided code snippet is an override of a method of the RadFileExplorer's content provider. Please take a look at the following help article for more detailed information on how the content provider works:
    Using custom FileBrowserContentProvider

    In order to display only the folders you need to implement custom content provider to the RadFileExplorer which subclasses the default FileSystemContentProvider and just override ResolveDirecotory() method using the code from my previous reply.

    An examples demonstrating how to implement custom content provider to RadFileExplorer and subclass FileSystemContentProvider are available in the following live demos:
    FileExplorer / Custom File Content Provider
    FileExplorer / Filter files and download

    All the best,
    Dobromir
    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
  14. Ravi
    Ravi avatar
    9 posts
    Member since:
    Apr 2013

    Posted 29 Apr 2014 in reply to Dobromir Link to this post

    Hi Dobromir,

      I have  seen your  zip code      everything is good  but i want change one thing   i want to browse client Machine folder   not  application folder  
     can i Browse the client Machine  folder   instead of  Root  Folder  of application  if yes  then how ?


  15. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 29 Apr 2014 Link to this post

    Hello Ravi,

    It is not possible to access user's local hard drive using JavaScript. This is not a restriction of RadFileExplorer but is a general security restriction.

    RadFileExplorer can be used to list physical directories that resides on the web server, or on a cloud server or even a file structure stored in a database, but to be able to list these files and / or manipulate them the web server which is running the website need to have the correct permissions.

    Regards,
    Dobromir
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  16. Ravi
    Ravi avatar
    9 posts
    Member since:
    Apr 2013

    Posted 29 Apr 2014 in reply to Dobromir Link to this post

    Thank you so much  for giving such valuable information related  to my previous post

    but Sir in case  of    <telerik:RadUpload ID="RadUpload1" runat="server">  </telerik:RadUpload>  this  we are able to browse  particular file  of client machine.    but i   don't want to browse particular file    i want to  browse folder (if this folder contain 5 file  i want to upload   all files on server    on folder selection ) of client machine  

    Please give me solution of this  problem 

     
  17. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 02 May 2014 Link to this post

    Hello Ravi,

    Once again - one cannot control the folder the end user is going to browse on their own machine when choosing files to upload. This is a browser restriction. If such control were possible, web pages would have access to the file system, which would be a huge security issue.

    If you want to be able to upload multiple files at once - you would need to use RadAsyncUpload: http://demos.telerik.com/aspnet-ajax/asyncupload/examples/multiplefileselection/defaultcs.aspx.


    Regards,

    Marin Bratanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  18. Ravi
    Ravi avatar
    9 posts
    Member since:
    Apr 2013

    Posted 02 May 2014 in reply to Marin Bratanov Link to this post

    thanks for reply sir

    Sir Please  build  google drive folder upload  like  functionality in    asp.net  web project  using    Telerik  control 
     



  19. Ravi
    Ravi avatar
    9 posts
    Member since:
    Apr 2013

    Posted 03 May 2014 in reply to Ravi Link to this post

    Sir is  there any third party tool  by which we can  upload   folder  in asp.net website   ?  
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017