How to trigger browseclick() manually?

Last post 08-28-2012, 9:11 AM by vso. 2 replies.
Sort Posts: Previous Next
  •  08-28-2012, 7:52 AM 74491

    How to trigger browseclick() manually?

    Is it possible to trigger the browseclick() action from JavaScript without having an InsertButton?
  •  08-28-2012, 8:38 AM 74494 in reply to 74491

    Re: How to trigger browseclick() manually?

    Hi vso,

     

    If you want to open the upload file dialog by code, for security reason, for now can not achieve it. The select file dialog must open by the end user click manually.

     

    If you want to catch the onclick event at client side, then please try the example code below.

     

    1. <%@ Page Language="C#" %>  
    2.   
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head id="Head1" runat="server">  
    6.     <title>example</title>  
    7. </head>  
    8. <body>  
    9.     <form id="form1" runat="server">  
    10.         <CuteWebUI:Uploader ID="Uploader1" runat="server">  
    11.         </CuteWebUI:Uploader>  
    12.     </form>  
    13. </body>  
    14. </html>  
    15.   
    16. <script type="text/javascript">  
    17. var uploader1=document.getElementById('<%=Uploader1.ClientID%>')  
    18. uploader1.handlebrowse=function()  
    19. {  
    20.     alert("click!");    
    21. }  
    22. </script>  
    Regards,

     

    Ken 

  •  08-28-2012, 9:11 AM 74499 in reply to 74494

    Re: How to trigger browseclick() manually?

    Hi Ken,

     

    opening the upload file dialog by code was interesting for me.

    Thank you for the quick reply! 

     

    Regards, 

    vso 

View as RSS news feed in XML