Cancel the browse dialogue

Last post 09-28-2012, 7:36 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  09-27-2012, 10:10 AM 74788

    Cancel the browse dialogue

    Hi, 
      
    I want to be able to cancel the users browse request.  For my application the user must select the destination directory before they click browse.  I have added a function and set the ButtonOnClickScript like this - 


    1. ButtonOnClickScript='CheckFolderSelected()'  
    2.   
    3. function CheckFolderSelected()      
    4. {      
    5.   var folderSelect = $('#mySelector');      
    6.   if (folderSelect == 'undefined' || folderSelect.val() == 'undefined')      
    7.   {      
    8.     alert('Please select a folder to save the uploaded files');      
    9.     // ** HERE I NEED TO CANCEL THE BROWSE DIALOGUE BOX **     
    10.   }      
    11. }    

    How can I cancel the browse dialogue? 

    Thanks 
    Andy

  •  09-28-2012, 7:36 AM 74813 in reply to 74788

    Re: Cancel the browse dialogue

    Hi Andy,

     

    Please try the way below. handlebrowse will fire when the user click on the uploader button, you can achieve your own logic in it.

     

    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 runat="server">  
    6.     <title>example</title>  
    7. </head>  
    8. <body>  
    9.     <form id="form1" runat="server">  
    10.         <table>  
    11.             <tr>  
    12.                 <td>  
    13.                     store path:  
    14.                 </td>  
    15.                 <td>  
    16.                     <asp:TextBox ID="tbPath" runat="server"></asp:TextBox>  
    17.                 </td>  
    18.             </tr>  
    19.             <tr>  
    20.                 <td>  
    21.                 </td>  
    22.                 <td>  
    23.                     <CuteWebUI:Uploader ID="Uploader1" runat="server">  
    24.                     </CuteWebUI:Uploader>  
    25.                 </td>  
    26.             </tr>  
    27.         </table>  
    28.     </form>  
    29. </body>  
    30. </html>  
    31.   
    32. <script type="text/javascript">  
    33. var uploader1=document.getElementById('<%=Uploader1.ClientID%>')  
    34. var tbPath=document.getElementById('<%=tbPath.ClientID%>')  
    35. uploader1.handlebrowse=function()  
    36. {  
    37.  if(tbPath.value==null||tbPath.value=="")  
    38.  {  
    39.  alert("please select the store path");  
    40.  return false;  
    41.  }  
    42. }  
    43. </script>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML