Re: Manual upload with visible="false"

  •  11-15-2012, 8:14 AM

    Re: Manual upload with visible="false"

    Ken,

     I apologize, that i don't clearly explained what i mean.

     

    Here is the code.

     

    There are 3 elements of  CuteWebUI:Uploader with ID "fileinput1", "fileinput2" and "fileinput3".

     

    Element with ID "fileinput1" has an attributeVisible="False". Other elements has an attribute Visible="True".

     

    If you run this code, and try to upload files using elements with ID "fileinput2" or (and) with ID "fileinput3", and press Submit button, uploads will not execute.

     

     But, if you change attribute of "fileinput1" from Visible="False" to "True", and try this case again, you will see that upload works.

     

     Also, you can try to do this case:

    1. For element "fileinput1" set attribute Visible to"True"

    2. For element "fileinput2" set attribute Visible to"False"

    3. For element "fileinput3" set attribute Visible to"True"

    4. Run page, choose file in "fileinput1" element for upload, and choose file in "fileinput3" for upload.

    5. Press Submit button to start upload.

    5. The result: file from "fileinput1" will uploaded, file from "fileinput3" will not uploaded.

     

    Code of page:

    1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="_myStartUploadingManually.aspx.cs" Inherits="AJAXUploader_new_version_basic_samples._myStartUploadingManually" %> 
    2. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %> 
    3.  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    5.  
    6. <html xmlns="http://www.w3.org/1999/xhtml"> 
    7. <head id="Head1" runat="server"> 
    8.     <title>Start uploading manually</title> 
    9.     <link rel="stylesheet" href="demo.css" type="text/css" />  
    10.     <script type="text/javascript" src="jquery-1.8.2.min.js"></script>  
    11.     <script type="text/javascript"> 
    12.          
    13.         function submitbutton_click() { 
    14.  
    15.             var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>'); 
    16.  
    17.             var fileInputs = ["<%=fileinput1.ClientID%>",
    18.                               "<%=fileinput2.ClientID%>",
    19.                               "<%=fileinput3.ClientID%>"]; 
    20.  
    21.             if (!window.filesuploaded) { 
    22.                 for(var i=0; i<3; i++) { 
    23.  
    24.                     var uploadobj = document.getElementById(fileInputs[i]); 
    25.                     if (uploadobj.getqueuecount() > 0) { 
    26.                         uploadobj.startupload(); 
    27.                     } 
    28.                 } 
    29.                 return false; 
    30.             } 
    31.              
    32.             window.filesuploaded = false
    33.             return true; 
    34.         } 
    35.          
    36.    </script>   
    37. </head> 
    38. <body> 
    39.     <form id="form1" runat="server">  
    40.         <asp:ScriptManager ID="Scriptmanager1" runat="server"></asp:ScriptManager> 
    41.         <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
    42.             <ContentTemplate> 
    43.                 <table border="0" cellpadding="0" cellspacing="0" width="100%">  
    44.                     <tr valign="middle">  
    45.                         <td class='standardText'><asp:Label Visible="true" ID="label1" runat="server">First file for upload</asp:Label></td>  
    46.                         <td class='standardText'>   
    47.                             <CuteWebUI:Uploader  
    48.                                 runat="server" 
    49.                                 ManualStartUpload="true" 
    50.                                 ID="fileinput1" 
    51.                                 InsertText="Browse Files1" 
    52.                                 onfileuploaded="fileinput_FileUploaded" 
    53.                                 MultipleFilesUpload="false" 
    54.                                 Visible="False"> 
    55.                             </CuteWebUI:Uploader> 
    56.                         </td> 
    57.                     </tr> 
    58.                     <tr valign="middle">  
    59.                         <td class='standardText'><asp:Label Visible="true" ID="label2" runat="server">Second file for upload</asp:Label></td>  
    60.                         <td class='standardText'> 
    61.                             <CuteWebUI:Uploader  
    62.                                 runat="server"  
    63.                                 ManualStartUpload="true"  
    64.                                 ID="fileinput2"   
    65.                                 InsertText="Browse Files2"  
    66.                                 onfileuploaded="fileinput_FileUploaded"  
    67.                                 MultipleFilesUpload="false"  
    68.                                 Visible="True"> 
    69.                             </CuteWebUI:Uploader> 
    70.                         </td> 
    71.                     </tr> 
    72.                     <tr valign="middle">  
    73.                         <td class='standardText'><asp:Label Visible="true" ID="label3" runat="server">Last file for upload</asp:Label></td>  
    74.                         <td class='standardText'> 
    75.                             <CuteWebUI:Uploader  
    76.                                 runat="server"  
    77.                                 ManualStartUpload="true"  
    78.                                 ID="fileinput3"   
    79.                                 InsertText="Browse Files3"  
    80.                                 onfileuploaded="fileinput_FileUploaded"  
    81.                                 MultipleFilesUpload="false"  
    82.                                 ValidateOption-MaxSizeKB="2097152"  
    83.                                 Visible="True"> 
    84.                             </CuteWebUI:Uploader> 
    85.                         </td> 
    86.                     </tr> 
    87.  
    88.                     <caption> 
    89.                         <p> 
    90.                             <asp:Button  
    91.                                 ID="SubmitButton"  
    92.                                 runat="server"  
    93.                                 Text="Submit"  
    94.                                 OnClientClick="return submitbutton_click()" /> 
    95.                         </p> 
    96.                     </caption> 
    97.                 </table> 
    98.             </ContentTemplate> 
    99.         </asp:UpdatePanel> 
    100.     </form> 
    101. </body> 
    102. </html> 
     Thanks,

    Alexey

View Complete Thread