access fileexplorer with javascript

3 posts, 1 answers
  1. Ronen
    Ronen avatar
    29 posts
    Member since:
    Aug 2010

    Posted 08 Aug 2010 Link to this post

    how do i access the filename selected in fileexplorer using javascript and put in in my asp label?
  2. Answer
    Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 11 Aug 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ronen
    Ronen avatar
    29 posts
    Member since:
    Aug 2010

    Posted 11 Aug 2010 Link to this post

    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);

    }

Back to Top