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

  •  02-25-2010, 7:04 PM

    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 Complete Thread