Standard File Queue Appearing Even Though Custom Queue Is Being Used

Last post 02-25-2010, 7:04 PM by cutechat. 5 replies.
Sort Posts: Previous Next
  •  02-24-2010, 12:21 PM 58948

    Standard File Queue Appearing Even Though Custom Queue Is Being Used

    Even though I've registered a javascript function on the uploader.handlequeueui property, the standard file queue is still being drawn after the file upload has completed (the one with the checkboxes on the left and the 'remove' link on the right of the table).
     
    I didn't notice anything in the AjaxUploaderDeveloperGuid documentation samples that shows the standard one being disabled.
     
    Should setting that handlequeueui property be enough to disable the standard queue from being rendered? Or is there no way to prevent it from being drawn?
     
    - John
  •  02-24-2010, 9:58 PM 58960 in reply to 58948

    Re: Standard File Queue Appearing Even Though Custom Queue Is Being Used

    Hi,
     
     
    You need return false to cancel the default UI
     
    Regards,
    Terry
     
  •  02-25-2010, 10:02 AM 58982 in reply to 58960

    Re: Standard File Queue Appearing Even Though Custom Queue Is Being Used

    I do have 'return false;' as the last line in the custom queue javascript function, and there aren't any errors on the page so it shouldn't be failing before returning false.
     
    I'm using a combination of javascript and code-behind though, and from Example 2 I figured out I could use the  following property to hide it.
     
    .GetItemsTable().Visible = False
     
    But as far as I can tell, the javascript 'return false;' does not work.
  •  02-25-2010, 2:14 PM 58991 in reply to 58982

    Re: Standard File Queue Appearing Even Though Custom Queue Is Being Used

    It appears that setting the .GetItemsTable().Visible = False causes the .Items collection to be empty on postback.
     
    Is this the correct behaviour?
     
  •  02-25-2010, 2:39 PM 58993 in reply to 58991

    Re: Standard File Queue Appearing Even Though Custom Queue Is Being Used

    I'm also noticing that if I modify the attributes or style collection (trying to set the style "display: none;" on the table for example) of the .GetItemsTable() the .Items collection of the UploadAttachments control is empty on postback.
  •  02-25-2010, 7:04 PM 58995 in reply to 58993

    Re: Standard File Queue Appearing Even Though Custom Queue Is Being Used

    Hi,
     
    I don't reproduce this issue. Make sure you have the last version.
     
    please try this :
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5.   
    6. <script runat="server">  
    7.   
    8.     protected override void OnPreRender(EventArgs e)   
    9.     {   
    10.         base.OnPreRender(e);   
    11.   
    12.         //hide the default table   
    13.         UploadAttachments1.GetItemsTable().Visible = false;   
    14.         //bind the grid every times   
    15.         DataGrid1.DataSource = UploadAttachments1.Items;   
    16.         DataGrid1.DataBind();   
    17.         DataGrid1.Visible = UploadAttachments1.Items.Count > 0;   
    18.     }   
    19.   
    20.     protected void DataGrid1_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)   
    21.     {   
    22.         Guid guid = (Guid)DataGrid1.DataKeys[e.Item.ItemIndex];   
    23.         foreach (AttachmentItem item in UploadAttachments1.Items)   
    24.         {   
    25.             if (item.FileGuid == guid)   
    26.             {   
    27.                 if (e.CommandName == "Download")   
    28.                 {   
    29.                     using (Stream str = item.OpenStream())   
    30.                     {   
    31.                         Response.AddHeader("Content-Disposition", "attachment; filename=\"" + item.FileName + "\"");   
    32.                         Response.AddHeader("Content-Length", item.FileSize.ToString());   
    33.                         byte[] buff = new byte[4096];   
    34.                         while (true)   
    35.                         {   
    36.                             int rc = str.Read(buff, 0, buff.Length);   
    37.                             if (rc == 0)   
    38.                                 break;   
    39.                             Response.OutputStream.Write(buff, 0, rc);   
    40.                         }   
    41.                     }   
    42.                 }   
    43.   
    44.                 if (e.CommandName == "Remove")   
    45.                 {   
    46.                     item.Remove();   
    47.                 }   
    48.   
    49.                 break;   
    50.             }   
    51.         }   
    52.     }   
    53.        
    54. </script>  
    55.   
    56. <html xmlns="http://www.w3.org/1999/xhtml">  
    57. <head runat="server">  
    58.     <title>DataGridCS</title>  
    59. </head>  
    60. <body>  
    61.     <form id="form1" runat="server">  
    62.         <div>  
    63.             <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" UploadType="Flash">  
    64.             </CuteWebUI:UploadAttachments>  
    65.             <hr />  
    66.             <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="false" DataKeyField="FileGuid"  
    67.                 OnItemCommand="DataGrid1_ItemCommand">  
    68.                 <Columns>  
    69.                     <asp:BoundColumn DataField="FileGuid" HeaderText="File Guid" />  
    70.                     <asp:BoundColumn DataField="FileName" HeaderText="File Name" />  
    71.                     <asp:BoundColumn DataField="FileSize" HeaderText="File Size" />  
    72.                     <asp:ButtonColumn CommandName="Remove" Text="Remove" />  
    73.                     <asp:ButtonColumn CommandName="Download" Text="Download" />  
    74.                     <asp:TemplateColumn>  
    75.                         <ItemTemplate>  
    76.                             <asp:ImageButton runat="server" ID="removeImg" ImageUrl="remove.gif" CommandName="Remove" />  
    77.                         </ItemTemplate>  
    78.                     </asp:TemplateColumn>  
    79.                 </Columns>  
    80.             </asp:DataGrid>  
    81.         </div>  
    82.     </form>  
    83. </body>  
    84. </html>  
     
     
    Regards,
    Terry
     
     
     
View as RSS news feed in XML