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

access fileexplorer with javascript

2 Answers 66 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Ronen
Top achievements
Rank 1
Ronen asked on 08 Aug 2010, 12:02 PM
how do i access the filename selected in fileexplorer using javascript and put in in my asp label?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 11 Aug 2010, 04:10 PM
Hi Ronen,

Here is a code example which demonstrates how to display the name of the selected RadFileExplorer item in a span element:

<script type="text/javascript">
    function OnClientItemSelected(sender, args) {
        var fileNameLabel = $get("FileNameLabel");
        var imageSrc = args.get_item().get_name();
        fileNameLabel.innerHTML = imageSrc;
         
    }
</script>
<telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="520px" Height="520px"
    OnClientItemSelected="OnClientItemSelected">
    <Configuration ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images" />
</telerik:RadFileExplorer>
<br />
The selected file name is: 
<span runat="server" id="FileNameLabel"></span>

For your convenience I have attached my test files.

Best regards,
Rumen
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
0
Ronen
Top achievements
Rank 1
answered on 11 Aug 2010, 04:17 PM
thanks, i already manged to do that using:

 

function fillFileName(sender, args) {

 

 

var label = document.getElementById('<%=TextBoxFileName.ClientID%>');

 

 

if (label != null)

 

label.innerText = args.get_item().get_path();

OnClientItemSelected(sender, args);

}

Tags
FileExplorer
Asked by
Ronen
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ronen
Top achievements
Rank 1
Share this question
or