Select dialog from JavaScript

Thread is closed for posting
4 posts, 0 answers
  1. james
    james avatar
    26 posts
    Member since:
    Jan 2007

    Posted 31 May 2008 Link to this post


    Is it possible fire File Select dialog from javascript?

    I woud like to call RadUpload's select button from javasript.

    Regrads,

    J


  2. james
    james avatar
    26 posts
    Member since:
    Jan 2007

    Posted 01 Jun 2008 Link to this post

    Hi,

    I find one solution

    I was add event on response started. Then I search file input. And rise click().

    My code:

            function conditionalPostback(e, sender) 
            { 
                if (sender.EventTarget.indexOf("$btn_20_10") != -1) 
                { 
                
                    var upload = $find("ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RadUpload1");  
     
                    var uploadBrowse = document.getElementById("ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RadUpload1file0");                
                    uploadBrowse.click(); 
                    
                                                            
                    //AJAX is disabled only if file is selected for upload 
                    if(upload.getFileInputs()[0].value != "") 
                    { 
                        sender.EnableAjax = false
                    } 
                } 
            } 

    But in this solution is one problem. On submit I get error: "htmlfile: Access is denied.".

    What is problem in my case?
    is it possible to get browse window with RadUpload's  client side API.
  3. james
    james avatar
    26 posts
    Member since:
    Jan 2007

    Posted 01 Jun 2008 Link to this post

    I think that is problem, because I didn't disable Ajaix on uploadBrowse How I can disable Ajaix for all elements?

    Thanks inadvance,

    J
  4. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 02 Jun 2008 Link to this post

    Hi james,

    The reason for the "Access is denied" error is not related to disabling Ajax calls. Actually this is a limitation of the browser. When the click method of an HTML file input element is called, the attempt for a form submission either throws an "Access is denied" error, or gets canceled (and the file input field gets cleared).

    To my regret calling the Browse dialog through javascript code is not possible in terms of server-side form submission.

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top