You must Sign In to post a response.
  • Category: ASP.Net MVC

    How to get open folder dialog box in asp.net mvc


    Are you looking for a way to get open folder dialog box in asp.net mvc ? then read this thread to know how get it



    Hi

    I need to select folder path(not file selection) in web application, please share your idea if anyone achieved this.

    Regards,
    Lingaraj Varatharajan.
  • #750494
    Hello Lingaraj

    Your question is not clear, still you can get filepaths from perticular directory using GetFiles() function of c#
    i have post snippet below take a look.

    using System.IO;

    string[] filePaths = Directory.GetFiles("directory path");

    In this way you can get all list of files with filepath using this code.
    you have to provide directory path from which you want to get filepaths
    I hope this will help you, if still you have any issue than tell me , i'll get back to you.

    Regards,
    Nirav Prabtani (Senior Web Developer)
    Email : niravjprabtani@gmail.com
    blog : niravprabtani.blogspot.in

  • #750510
    Hi,

    There is no folder browse control in ASP.net. You should implement it with other options. You can go throw the below.

    http://www.codeproject.com/Articles/21895/Directory-Browsing-in-ASP-Net-2-0
    http://www.dotnetspider.com/forum/330318-Folderbrowserdialog-functionalities-in-C.aspx

    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/

  • #750513
    Hi Lingraj,

    I don't think, asp.net has any dedicated controls for folder selection.
    Instead you can use directory browsing to achieve this. FOr this you can use the below code -

    <%@ Import Namespace="System.IO" %>
    <html>
    <body>
    <ul>
    <% foreach(var file in Directory.GetFiles("C:\\Temp", "*.*", SearchOption.AllDirectories)) { %>
    <li><%= file %></li>
    <% } %>
    </ul>
    </body>
    </html>


    Also you may visit the below article as how to get the directory-
    http://www.aspdotnet-suresh.com/2013/04/c-get-files-from-folder-directory-bind.html

    Hope this will help you !!

    Thanks,
    Ashutosh Jha
    http://tricksroad.com

  • #750558
    There is no Open folder dialog box present in Web based application for security purpose.
    The browser does not have access to select client machine folder structure so ultimately there is no chance to select folders
    Final answer is you do not have Folder Open dialog box in asp.net/web based environment

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #750698
    The straight forward answer is no, there is only a option of File upload control and there is no Folder Browser option.

    if you still want to use it, make use of some third party control.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM


  • Sign In to post your comments