We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Adding a hyperlink to open FileExplorer

Hi !

Well, the question is, How I can open the fileexplorer with a hyperlink, but in a especific Folder.

Thank you.

5 Replies

AB Ashokkumar Balasubramanian Syncfusion Team October 3, 2019 10:36 AM UTC

Hi eduardo,  
 
Good day to you. 
 
We suspect that you need to open a page with FileExplorer with a specific selected folder when clicking on the asp HyperLink. If so, we suggest you to render FileExplorer in an aspx page with “SelectedFolder” property and add this path to  NavigateUrl property of asp:HyperLink in another page. Please refer to the following code 
 
Default.aspx: 
 
<asp:HyperLink id="hyperlink1" NavigateUrl="~/FileExplorer/FileExplorerFeatures.aspx" Text="Open FileExplorer" runat="server"/>            
 
FileExplorer.aspx: 
 
<ej:FileExplorer ID="fileexplorer1" runat="server" IsResponsive="true" Width="100%" AjaxAction="FileExplorerFeatures.aspx/FileActionDefault" Path="~/Content/images/FileExplorer" SelectedFolder="~/Content/images/FileExplorer/Nature"> 
            <AjaxSettings> 
                <Download Url="downloadFile.ashx{0}" /> 
                <Upload Url="uploadFiles.ashx{0}" /> 
            </AjaxSettings> 
        </ej:FileExplorer> 
 
Sample can be downloaded from the following link 
 
 
If we have misunderstood kindly share us clear details on your requirement like whether you need to hide the FileExplorer initially and show this during hyperlink click on the same page or some other dialog else you need to render FileExplorer only on Hyperlink click so that we can proceed further.  
 
Regards, 
Ashokkumar B. 



EM eduardo manuel leon cuya October 3, 2019 02:37 PM UTC

I want to put some hyperlinks, but when i Click over that, send me to their files, I have a list, so, I can't do that manually.

The list is like the SS 



I can do that ? or not ?

The list, is by a DB, so I can't do that manually.


AB Ashokkumar Balasubramanian Syncfusion Team October 4, 2019 07:28 AM UTC

Hi Eduardo,  
 
Based on the shared image we are not clear on whether the list displayed is an EJ component or ASP component. Based on UI, we have just displayed a Table list with LinkButton as shown below.  
 
 
 
On clicking link button , FileExplorer will be opened inside dialog with  the provided folder path. Please refer to the following code.  
 
<ej:Dialog ID="dialog" Title="File Details" runat="server" ShowOnInit="false" Width="600"> 
     <DialogContent> 
          <ej:FileExplorer ID="fileexplorer1" runat="server" Width="580" IsResponsive="true" AjaxAction="/FileExplorer/FileExplorerFeatures.aspx/FileActionDefault" Path="~/Content/images/FileExplorer" ClientSideOnCreate="onCreate"> 
            <AjaxSettings> 
                <Download Url="downloadFile.ashx{0}" /> 
                <Upload Url="uploadFiles.ashx{0}" /> 
            </AjaxSettings> 
        </ej:FileExplorer> 
     </DialogContent> 
</ej:Dialog> 
  <asp:Table ID="Table1" runat="server" Height="200" Width="500"> 
            <asp:TableRow runat="server" BorderStyle="Solid" BorderWidth="1px"> 
                  <asp:TableCell runat="server"> 
                  <asp:HyperLink runat="server" ID="setting" ><i class="fa fa-gear"></i></asp:HyperLink> 
                </asp:TableCell> 
                <asp:TableCell runat="server"> 
                    <asp:LinkButton runat="server" ClientIDMode="Static" ID="file1" text="Nature" OnClientClick="showFile(this)"><i class="fa fa-edit"></i></asp:LinkButton>                 
                </asp:TableCell>                 
            </asp:TableRow> 
            <asp:TableRow runat="server"  BorderStyle="Solid" BorderWidth="1px"> 
                <asp:TableCell runat="server"> 
                  <asp:LinkButton ID="file2" OnClientClick="showFile(this)" ClientIDMode="Static" runat="server"><i class="fa fa-edit"></i></asp:LinkButton>   
                </asp:TableCell> 
            </asp:TableRow> 
           .  .   .   . 
        </asp:Table> 
     
    <script> 
        var diaObj, FileObj; 
 
        function onCreate(args) { 
            FileObj = this; 
        } 
        function showFile(e) { 
            var diaObj = $("#<%=dialog.ClientID%>").data("ejDialog"); 
            console.log(e.id); //get selected link button id; 
            if (e.id == "file1") { 
                FileObj.setModel({ selectedFolder: "~/Content/images/FileExplorer/Nature" }); //set selected folder based on the link clicked.  
            } 
            else if (e.id == "file2") { 
                FileObj.setModel({selectedFolder:"~/Content/images/FileExplorer/Employees"}) 
            } 
            else if (e.id == "file3") { 
                FileObj.setModel({selectedFolder:"~/Content/images/FileExplorer/Food"}) 
            } 
              diaObj.open();     //open dialog with FileExplorer 
            FileObj.adjustSize(); //refresh FileExplorer        } 
    </script> 
 
Sample can be downloaded from the following link: 
 
 
As you mentioned that list is rendered from DB, you can bind an event for this hyperlink button after list rendering and set selectedFolder for FileExplorer as done in our sample.  
 
Regards, 
Ashokkumar B. 



EM eduardo manuel leon cuya October 4, 2019 03:55 PM UTC

I can't Open your example, but I try to do in my webapp, so when i compile, and try to do that buttons, the file explorer don't open, so I get an error in my console:



How I can fix it ? Can you send me another example ?
Yours example got errors:



I can't compile them


AB Ashokkumar Balasubramanian Syncfusion Team October 7, 2019 12:04 PM UTC

Hi Eduardo, 
  
Based on the error details, we suspect that the Syncfusion assemblies of required version is not installed in your sample. As we are not aware of the Syncfusion version you use, we suggest you install the packages and scripts through NuGet packages from the below link 
  
  
Execute the project after installing the package and ensure in your end. If still you face any issue share us the version in which you require a sample so that we will provide you a sample in that version 
  
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon