This is a migrated thread and some comments may be shown as answers.

select a folder from local and show the full path in text box

4 Answers 161 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Wassim
Top achievements
Rank 1
Veteran
Iron
Wassim asked on 21 Dec 2020, 03:35 PM

Hello,

 

 

I  am working with telerik ui for asp.net mvc.

I have a textbox named path of poste.

By entering, it should show me the tree view of my local directories in a window.

when I select a directory, I need to show only the full path in my text box.

So i need to show the path of the selected folder from my local folders. How can I do this ?

Any help or suggestions please ?

4 Answers, 1 is accepted

Sort by
0
Wassim
Top achievements
Rank 1
Veteran
Iron
answered on 21 Dec 2020, 07:29 PM

To be more clear..

I have a text box and a button. When i chick the buttonn i need to get the browse option so that i can browse all folders in my system, after that if i select the folder, the folder path should be displayed in my TextBox like C:/Users/myFolder/   in textbox.. also when select an UCN path.

I did not find the way to do this !

It would be much appreciated if you can help me on this.
Thanks for replying 

0
Nikolay
Telerik team
answered on 23 Dec 2020, 12:25 PM

Hello Wassim,

The TreeView component does not allow browsing the local computer directories but rather gives a representation of hierarchical data in a tree structure.

What I can suggest is to represent the desired directories in the treeView and in the Change or Check event handlers to manually set the TextBox value. For example:

.Events(events => events
                .Change("onChange")
)
...
<script>
function onChange(e) {
    var treeView = e.sender;
    selected = treeView .select(),
    directory= treeView .dataItem(selected).text;

    var textbox = $("#textbox").data("kendoTextBox");
    textbox.value(directory);
}
</script>

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Wassim
Top achievements
Rank 1
Veteran
Iron
answered on 24 Dec 2020, 04:29 PM

Thanks for replying.

Yes, you are right. I understood that a browser does not allow to select a folder from a network share or a location on the web server. 

But I don't have a treeview component. 

I have juste a textBox and a button when clicking i can browse all folders in my system, after that if i select the folder, the folder path should be displayed in my TextBox.

Any suggestions?

Best regards,

 


0
Nikolay
Telerik team
answered on 28 Dec 2020, 12:12 PM

Hi Wassim,

I can suggest checking out the approaches shared in the following SO threads. Please note that in general, for security reasons sharing a file directory with a web application is not a good practice.

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TextBox
Asked by
Wassim
Top achievements
Rank 1
Veteran
Iron
Answers by
Wassim
Top achievements
Rank 1
Veteran
Iron
Nikolay
Telerik team
Share this question
or